Skip to content

Commit 6f46c67

Browse files
committed
Fix handling of excluded branches.
Pass on data, check that each branch is added only once.
1 parent fe9a964 commit 6f46c67

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ static BranchConfig InheritBranchConfiguration(bool onlyEvaluateTrackedBranches,
8080
return (branchConfig.Length != 1) || (branchConfig.Length == 1 && branchConfig[0].Increment == IncrementStrategy.Inherit);
8181
}).ToList();
8282
}
83-
excludedBranches.ToList().ForEach(excludedInheritBranches.Add);
83+
// Add new excluded branches.
84+
foreach (var excludedBranch in excludedBranches.ExcludingBranches(excludedInheritBranches))
85+
{
86+
excludedInheritBranches.Add(excludedBranch);
87+
}
8488
var branchesToEvaluate = repository.Branches.Except(excludedInheritBranches).ToList();
8589

8690
var branchPoint = currentBranch.FindCommitBranchWasBranchedFrom(repository, excludedInheritBranches.ToArray());
@@ -141,7 +145,7 @@ static BranchConfig InheritBranchConfiguration(bool onlyEvaluateTrackedBranches,
141145
var branchName = chosenBranch.FriendlyName;
142146
Logger.WriteWarning(errorMessage + Environment.NewLine + Environment.NewLine + "Falling back to " + branchName + " branch config");
143147

144-
var inheritingBranchConfig = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, chosenBranch);
148+
var inheritingBranchConfig = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, chosenBranch, excludedInheritBranches);
145149
return new BranchConfig(branchConfiguration)
146150
{
147151
Increment = inheritingBranchConfig.Increment,

0 commit comments

Comments
 (0)