Skip to content

Commit f185080

Browse files
DanielRoseJakeGinnivan
authored andcommitted
Fix handling of excluded branches.
Pass on data, check that each branch is added only once.
1 parent a88e863 commit f185080

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
@@ -83,7 +83,11 @@ static BranchConfig InheritBranchConfiguration(bool onlyEvaluateTrackedBranches,
8383
return (branchConfig.Length != 1) || (branchConfig.Length == 1 && branchConfig[0].Increment == IncrementStrategy.Inherit);
8484
}).ToList();
8585
}
86-
excludedBranches.ToList().ForEach(excludedInheritBranches.Add);
86+
// Add new excluded branches.
87+
foreach (var excludedBranch in excludedBranches.ExcludingBranches(excludedInheritBranches))
88+
{
89+
excludedInheritBranches.Add(excludedBranch);
90+
}
8791
var branchesToEvaluate = repository.Branches.Except(excludedInheritBranches).ToList();
8892

8993
var branchPoint = currentBranch.FindCommitBranchWasBranchedFrom(repository, excludedInheritBranches.ToArray());
@@ -144,7 +148,7 @@ static BranchConfig InheritBranchConfiguration(bool onlyEvaluateTrackedBranches,
144148
var branchName = chosenBranch.FriendlyName;
145149
Logger.WriteWarning(errorMessage + Environment.NewLine + Environment.NewLine + "Falling back to " + branchName + " branch config");
146150

147-
var inheritingBranchConfig = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, chosenBranch);
151+
var inheritingBranchConfig = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, chosenBranch, excludedInheritBranches);
148152
return new BranchConfig(branchConfiguration)
149153
{
150154
Increment = inheritingBranchConfig.Increment,

0 commit comments

Comments
 (0)