diff options
author | Jameson Miller <jamill@microsoft.com> | 2013-02-05 01:28:06 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-02-06 02:35:02 +0400 |
commit | 6b9afb26814b0ffb9b440eca9a2d06ff0130c8d8 (patch) | |
tree | bc24bd443fdbecc3e188cea5041e255d9e817435 /LibGit2Sharp.Tests/BranchFixture.cs | |
parent | 745da08194c73bf0fa1a64c5317eb766a272507b (diff) |
Teach BranchCollection to disambiguate local and remote branch names
Diffstat (limited to 'LibGit2Sharp.Tests/BranchFixture.cs')
-rw-r--r-- | LibGit2Sharp.Tests/BranchFixture.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs index 1a24ff03..916dc7ec 100644 --- a/LibGit2Sharp.Tests/BranchFixture.cs +++ b/LibGit2Sharp.Tests/BranchFixture.cs @@ -190,6 +190,27 @@ namespace LibGit2Sharp.Tests } [Fact] + public void CanListBranchesWithRemoteAndLocalBranchWithSameShortName() + { + TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoWorkingDirPath); + + using (var repo = new Repository(path.RepositoryPath)) + { + // Create a local branch with the same short name as a remote branch. + repo.Branches.Add("origin/master", repo.Branches["origin/test"].Tip); + + var expectedWdBranches = new[] + { + "diff-test-cases", "i-do-numbers", "logo", "master", "origin/master", "track-local", + }; + + Assert.Equal(expectedWdBranches, repo.Branches + .Where(b => !b.IsRemote) + .Select(b => b.Name).ToArray()); + } + } + + [Fact] public void CanListAllBranchesWhenGivenWorkingDir() { using (var repo = new Repository(StandardTestRepoWorkingDirPath)) |