Skip to content

Commit 00f60a4

Browse files
committed
Fixed all broken existing tests
1 parent 9fdcb69 commit 00f60a4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,15 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(bool onlyEv
8383
else
8484
{
8585
var branches = branchPoint.GetBranchesContainingCommit(repository, true).Except(excludedInheritBranches).ToList();
86-
var currentTipBranches = currentCommit.GetBranchesContainingCommit(repository, true).Except(excludedInheritBranches).ToList();
87-
possibleParents = branches
88-
.Except(currentTipBranches)
89-
.ToList();
86+
if (branches.Count > 1)
87+
{
88+
var currentTipBranches = currentCommit.GetBranchesContainingCommit(repository, true).Except(excludedInheritBranches).ToList();
89+
possibleParents = branches.Except(currentTipBranches).ToList();
90+
}
91+
else
92+
{
93+
possibleParents = branches;
94+
}
9095
}
9196

9297
Logger.WriteInfo("Found possible parent branches: " + string.Join(", ", possibleParents.Select(p => p.Name)));

GitVersionCore/LibGitExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static Branch FindBranch(this IRepository repository, string branchName)
2626

2727
public static Commit FindCommitBranchWasBranchedFrom(this Branch branch, IRepository repository, params Branch[] excludedBranches)
2828
{
29-
var otherBranches = repository.Branches.Where(b => !b.IsRemote).Except(excludedBranches).Except(new [] { branch });
29+
var otherBranches = repository.Branches.Where(b => !b.IsRemote).Except(excludedBranches).Except(new [] { branch }).ToList();
3030
var mergeBases = otherBranches.Select(b =>
3131
{
3232
var otherCommit = b.Tip;

0 commit comments

Comments
 (0)