diff --git a/appveyor.yml b/appveyor.yml index 9cfcd2f..4dc2c7c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ install: - choco install gitversion.portable -pre -y - - cinst gitlink -pre -y + - cinst gitlink -y platform: - Any CPU diff --git a/src/GitTools.Core/GitTools.Core.Shared/Git/Helpers/GitRepositoryHelper.cs b/src/GitTools.Core/GitTools.Core.Shared/Git/Helpers/GitRepositoryHelper.cs index 43d7b39..d9d6b24 100644 --- a/src/GitTools.Core/GitTools.Core.Shared/Git/Helpers/GitRepositoryHelper.cs +++ b/src/GitTools.Core/GitTools.Core.Shared/Git/Helpers/GitRepositoryHelper.cs @@ -139,7 +139,17 @@ static void EnsureLocalBranchExistsForCurrentBranch(Repository repo, string curr var isRef = currentBranch.Contains("refs"); var isBranch = currentBranch.Contains("refs/heads"); var localCanonicalName = !isRef ? "refs/heads/" + currentBranch : isBranch ? currentBranch : currentBranch.Replace("refs/", "refs/heads/"); + var repoTip = repo.Head.Tip; + + // We currently have the rep.Head of the *default* branch, now we need to look up the right one + var originCanonicalName = string.Format("origin/{0}", currentBranch); + var originBranch = repo.Branches[originCanonicalName]; + if (originBranch != null) + { + repoTip = originBranch.Tip; + } + var repoTipId = repoTip.Id; if (repo.Branches.All(b => b.CanonicalName != localCanonicalName))