Skip to content

Commit 8b9aef9

Browse files
committed
(#260) Favour local branches over remote ones
- Updated with suggestion from @nulltoken - #262 (comment)
1 parent d1fafa1 commit 8b9aef9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public static void NormalizeGitDirectory(string gitDirectory, Authentication aut
3838
// In order to decide whether a fake branch is required or not, first check to see if any local branches have the same commit SHA of the head SHA.
3939
// If they do, go ahead and checkout that branch
4040
// If no, go ahead and check out a new branch, using the known commit SHA as the pointer
41-
var localBranchesWhereCommitShaIsHead = repo.Branches.Where(b => b.Tip.Sha == headSha).ToList();
42-
41+
var localBranchesWhereCommitShaIsHead = repo.Branches.Where(b => !b.IsRemote && b.Tip.Sha == headSha).ToList();
42+
4343
if (localBranchesWhereCommitShaIsHead.Count > 1)
4444
{
4545
var names = string.Join(", ", localBranchesWhereCommitShaIsHead.Select(r => r.CanonicalName));

0 commit comments

Comments
 (0)