Skip to content

Commit 4c5d53e

Browse files
committed
Better more targeted fix
1 parent 4b8cb31 commit 4c5d53e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ namespace GitVersion
88

99
public class BranchConfigurationCalculator
1010
{
11+
public static string FallbackConfigName = "Fallback";
12+
1113
/// <summary>
1214
/// Gets the <see cref="BranchConfig"/> for the current commit.
1315
/// </summary>
@@ -21,7 +23,7 @@ public static BranchConfig GetBranchConfiguration(GitVersionContext context, Bra
2123
"No branch configuration found for branch {0}, falling back to default configuration",
2224
targetBranch.FriendlyName));
2325

24-
matchingBranches = new BranchConfig { Name = string.Empty };
26+
matchingBranches = new BranchConfig { Name = FallbackConfigName };
2527
ConfigurationProvider.ApplyBranchDefaults(context.FullConfiguration, matchingBranches, "", new List<string>());
2628
}
2729

@@ -135,9 +137,15 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
135137
}
136138

137139
var inheritingBranchConfig = GetBranchConfiguration(context, chosenBranch, excludedInheritBranches);
140+
var configIncrement = inheritingBranchConfig.Increment;
141+
if (inheritingBranchConfig.Name == FallbackConfigName && configIncrement == IncrementStrategy.Inherit)
142+
{
143+
Logger.WriteWarning("Fallback config inherits by default, dropping to patch increment");
144+
configIncrement = IncrementStrategy.Patch;
145+
}
138146
return new BranchConfig(branchConfiguration)
139147
{
140-
Increment = inheritingBranchConfig.Increment,
148+
Increment = configIncrement,
141149
PreventIncrementOfMergedBranchVersion = inheritingBranchConfig.PreventIncrementOfMergedBranchVersion,
142150
// If we are inheriting from develop then we should behave like develop
143151
TracksReleaseBranches = inheritingBranchConfig.TracksReleaseBranches

src/GitVersionCore/Configuration/ConfigurationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class ConfigurationProvider
3030
public const string SupportBranchKey = "support";
3131
public const string DevelopBranchKey = "develop";
3232

33-
private const IncrementStrategy DefaultIncrementStrategy = IncrementStrategy.Patch;
33+
private const IncrementStrategy DefaultIncrementStrategy = IncrementStrategy.Inherit;
3434

3535
public static Config Provide(GitPreparer gitPreparer, IFileSystem fileSystem, bool applyDefaults = true, Config overrideConfig = null)
3636
{

0 commit comments

Comments
 (0)