@@ -8,6 +8,8 @@ namespace GitVersion
8
8
9
9
public class BranchConfigurationCalculator
10
10
{
11
+ public static string FallbackConfigName = "Fallback" ;
12
+
11
13
/// <summary>
12
14
/// Gets the <see cref="BranchConfig"/> for the current commit.
13
15
/// </summary>
@@ -21,7 +23,7 @@ public static BranchConfig GetBranchConfiguration(GitVersionContext context, Bra
21
23
"No branch configuration found for branch {0}, falling back to default configuration" ,
22
24
targetBranch . FriendlyName ) ) ;
23
25
24
- matchingBranches = new BranchConfig { Name = string . Empty } ;
26
+ matchingBranches = new BranchConfig { Name = FallbackConfigName } ;
25
27
ConfigurationProvider . ApplyBranchDefaults ( context . FullConfiguration , matchingBranches , "" , new List < string > ( ) ) ;
26
28
}
27
29
@@ -65,7 +67,7 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
65
67
List < Branch > possibleParents ;
66
68
if ( branchPoint == BranchCommit . Empty )
67
69
{
68
- possibleParents = context . RepositoryMetadataProvider . GetBranchesContainingCommit ( context . CurrentCommit , branchesToEvaluate , true )
70
+ possibleParents = context . RepositoryMetadataProvider . GetBranchesContainingCommit ( targetBranch . Tip , branchesToEvaluate , true )
69
71
// It fails to inherit Increment branch configuration if more than 1 parent;
70
72
// therefore no point to get more than 2 parents
71
73
. Take ( 2 )
@@ -135,9 +137,15 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
135
137
}
136
138
137
139
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
+ }
138
146
return new BranchConfig ( branchConfiguration )
139
147
{
140
- Increment = inheritingBranchConfig . Increment ,
148
+ Increment = configIncrement ,
141
149
PreventIncrementOfMergedBranchVersion = inheritingBranchConfig . PreventIncrementOfMergedBranchVersion ,
142
150
// If we are inheriting from develop then we should behave like develop
143
151
TracksReleaseBranches = inheritingBranchConfig . TracksReleaseBranches
0 commit comments