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

Commit e1bfa23

Browse files
committed
Allow repository names to differ in case
1 parent f81fb36 commit e1bfa23

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/GitHub.VisualStudio/Commands/OpenFromClipboardCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public override async Task Execute(string url)
6363
return;
6464
}
6565

66-
if (activeRepository.Name != context.RepositoryName)
66+
if (!string.Equals(activeRepository.Name, context.RepositoryName, StringComparison.OrdinalIgnoreCase))
6767
{
6868
vsServices.Value.ShowMessageBoxInfo(string.Format(DifferentRepositoryMessage, context.RepositoryName));
6969
return;

test/GitHub.VisualStudio.UnitTests/Commands/OpenFromClipboardCommandTests.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,28 @@ public async Task NoLocalRepository()
3535
vsServices.Received(1).ShowMessageBoxInfo(OpenFromClipboardCommand.NoActiveRepositoryMessage);
3636
}
3737

38-
[Test]
39-
public async Task DifferentLocalRepository()
38+
[TestCase("targetRepositoryName", "activeRepositoryName", OpenFromClipboardCommand.DifferentRepositoryMessage)]
39+
[TestCase("SameRepositoryName", "SameRepositoryName", null)]
40+
[TestCase("same_repository_name", "SAME_REPOSITORY_NAME", null)]
41+
public async Task DifferentLocalRepository(string targetRepositoryName, string activeRepositoryName, string expectMessage)
4042
{
41-
var targetRepositoryName = "targetRepositoryName";
42-
var activeRepositoryName = "activeRepositoryName";
4343
var activeRepositoryDir = "activeRepositoryDir";
4444
var context = new GitHubContext { RepositoryName = targetRepositoryName };
45-
(string, string, string)? resolveBlobResult = null;
45+
var resolveBlobResult = ("commitish", "path", "SHA");
4646
var vsServices = Substitute.For<IVSServices>();
4747
var target = CreateOpenFromClipboardCommand(vsServices: vsServices,
4848
contextFromClipboard: context, repositoryDir: activeRepositoryDir, repositoryName: activeRepositoryName, resolveBlobResult: resolveBlobResult);
4949

5050
await target.Execute(null);
5151

52-
vsServices.Received(1).ShowMessageBoxInfo(string.Format(OpenFromClipboardCommand.DifferentRepositoryMessage, context.RepositoryName));
52+
if (expectMessage != null)
53+
{
54+
vsServices.Received(1).ShowMessageBoxInfo(string.Format(expectMessage, context.RepositoryName));
55+
}
56+
else
57+
{
58+
vsServices.DidNotReceiveWithAnyArgs().ShowMessageBoxInfo(null);
59+
}
5360
}
5461

5562
[TestCase("TargetOwner", "CurrentOwner", OpenFromClipboardCommand.NoResolveDifferentOwnerMessage)]

0 commit comments

Comments
 (0)