Skip to content

Commit 698515e

Browse files
committed
Fixed logic around what branches to exclude from inheriting config
1 parent cddf40b commit 698515e

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
5959
{
6060
excludedInheritBranches = repository.Branches.Where(b =>
6161
{
62-
var branchConfig = config.GetConfigForBranch(b.FriendlyName);
62+
var branchConfig = config.GetConfigForBranch(b.NameWithoutRemote());
6363

64-
return branchConfig != null && branchConfig.Increment == IncrementStrategy.Inherit;
64+
return branchConfig == null || branchConfig.Increment == IncrementStrategy.Inherit;
6565
}).ToList();
6666
}
6767
// Add new excluded branches.
6868
foreach (var excludedBranch in excludedBranches.ExcludingBranches(excludedInheritBranches))
6969
{
7070
excludedInheritBranches.Add(excludedBranch);
7171
}
72-
var branchesToEvaluate = repository.Branches.Except(excludedInheritBranches).ToList();
72+
var branchesToEvaluate = repository.Branches.ExcludingBranches(excludedInheritBranches).ToList();
7373

7474
var branchPoint = context.RepositoryMetadataProvider
7575
.FindCommitBranchWasBranchedFrom(targetBranch, excludedInheritBranches.ToArray());
@@ -116,25 +116,6 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
116116
}
117117
}
118118

119-
if (possibleParents.Count > 1)
120-
{
121-
// Lets try and get the branch config for each possible parent, the first may not have config
122-
foreach (var possibleParent in possibleParents)
123-
{
124-
var branchConfig = GetBranchConfiguration(context, possibleParent, excludedInheritBranches);
125-
if (branchConfig.Name != FallbackConfigName)
126-
{
127-
return new BranchConfig(branchConfiguration)
128-
{
129-
Increment = branchConfig.Increment,
130-
PreventIncrementOfMergedBranchVersion = branchConfig.PreventIncrementOfMergedBranchVersion,
131-
// If we are inheriting from develop then we should behave like develop
132-
TracksReleaseBranches = branchConfig.TracksReleaseBranches
133-
};
134-
}
135-
}
136-
}
137-
138119
// If we fail to inherit it is probably because the branch has been merged and we can't do much. So we will fall back to develop's config
139120
// if develop exists and master if not
140121
string errorMessage;

0 commit comments

Comments
 (0)