@@ -27,11 +27,11 @@ public BranchConfigurationCalculator(ILog log, IRepositoryStore repositoryStore)
27
27
public BranchConfig GetBranchConfiguration ( IBranch targetBranch , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches = null ) =>
28
28
GetBranchConfigurationInternal ( 0 , targetBranch , currentCommit , configuration , excludedInheritBranches ) ;
29
29
30
- private BranchConfig GetBranchConfigurationInternal ( int recursiveLevel , IBranch targetBranch , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches = null )
30
+ private BranchConfig GetBranchConfigurationInternal ( int recursions , IBranch targetBranch , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches = null )
31
31
{
32
- if ( recursiveLevel >= MaxRecursions )
32
+ if ( recursions >= MaxRecursions )
33
33
{
34
- throw new InfiniteLoopProtectionException ( $ "Inherited branch configuration caused { recursiveLevel } recursions. Aborting!") ;
34
+ throw new InfiniteLoopProtectionException ( $ "Inherited branch configuration caused { recursions } recursions. Aborting!") ;
35
35
}
36
36
37
37
var matchingBranches = configuration . GetConfigForBranch ( targetBranch . Name . WithoutRemote ) ;
@@ -51,7 +51,7 @@ private BranchConfig GetBranchConfigurationInternal(int recursiveLevel, IBranch
51
51
52
52
if ( matchingBranches . Increment == IncrementStrategy . Inherit )
53
53
{
54
- matchingBranches = InheritBranchConfiguration ( recursiveLevel , targetBranch , matchingBranches , currentCommit , configuration , excludedInheritBranches ) ;
54
+ matchingBranches = InheritBranchConfiguration ( recursions , targetBranch , matchingBranches , currentCommit , configuration , excludedInheritBranches ) ;
55
55
if ( matchingBranches . Name ! . IsEquivalentTo ( FallbackConfigName ) && matchingBranches . Increment == IncrementStrategy . Inherit )
56
56
{
57
57
// We tried, and failed to inherit, just fall back to patch
@@ -64,11 +64,11 @@ private BranchConfig GetBranchConfigurationInternal(int recursiveLevel, IBranch
64
64
}
65
65
66
66
// TODO I think we need to take a fresh approach to this.. it's getting really complex with heaps of edge cases
67
- private BranchConfig InheritBranchConfiguration ( int recursiveLevel , IBranch targetBranch , BranchConfig branchConfiguration , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches )
67
+ private BranchConfig InheritBranchConfiguration ( int recursions , IBranch targetBranch , BranchConfig branchConfiguration , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches )
68
68
{
69
69
using ( this . log . IndentLog ( "Attempting to inherit branch configuration from parent branch" ) )
70
70
{
71
- recursiveLevel += 1 ;
71
+ recursions += 1 ;
72
72
73
73
var excludedBranches = new [ ] { targetBranch } ;
74
74
// Check if we are a merge commit. If so likely we are a pull request
@@ -119,7 +119,7 @@ private BranchConfig InheritBranchConfiguration(int recursiveLevel, IBranch targ
119
119
120
120
if ( possibleParents . Count == 1 )
121
121
{
122
- var branchConfig = GetBranchConfigurationInternal ( recursiveLevel , possibleParents [ 0 ] , currentCommit , configuration , excludedInheritBranches ) ;
122
+ var branchConfig = GetBranchConfigurationInternal ( recursions , possibleParents [ 0 ] , currentCommit , configuration , excludedInheritBranches ) ;
123
123
// If we have resolved a fallback config we should not return that we have got config
124
124
if ( branchConfig . Name != FallbackConfigName )
125
125
{
@@ -167,7 +167,7 @@ private BranchConfig InheritBranchConfiguration(int recursiveLevel, IBranch targ
167
167
} ;
168
168
}
169
169
170
- var inheritingBranchConfig = GetBranchConfigurationInternal ( recursiveLevel , chosenBranch , currentCommit , configuration , excludedInheritBranches ) ! ;
170
+ var inheritingBranchConfig = GetBranchConfigurationInternal ( recursions , chosenBranch , currentCommit , configuration , excludedInheritBranches ) ! ;
171
171
var configIncrement = inheritingBranchConfig . Increment ;
172
172
if ( inheritingBranchConfig . Name ! . IsEquivalentTo ( FallbackConfigName ) && configIncrement == IncrementStrategy . Inherit )
173
173
{
0 commit comments