Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 2e2f2f5

Browse files
committed
Allow searching by repository URL
1 parent 3a810e9 commit 2e2f2f5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/GitHub.App/ViewModels/Dialog/Clone/RepositorySelectViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ bool FilterItem(object obj)
166166
{
167167
if (obj is IRepositoryItemViewModel item && !string.IsNullOrWhiteSpace(Filter))
168168
{
169-
return item.Caption.Contains(Filter, StringComparison.CurrentCultureIgnoreCase);
169+
return
170+
item.Caption.Contains(Filter, StringComparison.CurrentCultureIgnoreCase) ||
171+
item.Url.ToString().Equals(Filter, StringComparison.OrdinalIgnoreCase);
170172
}
171173

172174
return true;

test/GitHub.App.UnitTests/ViewModels/Dialog/Clone/RepositorySelectViewModelTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class TheFilterProperty
2020
[TestCase("name", "owner", "name", "https://github.com/owner/name", 1)]
2121
[TestCase("owner/name", "owner", "name", "https://github.com/owner/name", 1)]
2222
[TestCase("OWNER/NAME", "owner", "name", "https://github.com/owner/name", 1)]
23+
[TestCase("https://github.com/owner/name", "owner", "name", "https://github.com/owner/name", 1)]
24+
[TestCase("HTTPS://GITHUB.COM/OWNER/NAME", "owner", "name", "https://github.com/owner/name", 1)]
2325
public async Task Filter(string filter, string owner, string name, string url, int expectCount)
2426
{
2527
var contributedToRepositories = new[]

0 commit comments

Comments
 (0)