@@ -27,11 +27,11 @@ public BranchConfigurationCalculator(ILog log, IRepositoryStore repositoryStore)
2727 public BranchConfig GetBranchConfiguration ( IBranch targetBranch , ICommit ? currentCommit , Config configuration , IList < IBranch > ? excludedInheritBranches = null ) =>
2828 GetBranchConfigurationInternal ( 0 , targetBranch , currentCommit , configuration , excludedInheritBranches ) ;
2929
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 )
3131 {
32- if ( recursiveLevel >= MaxRecursions )
32+ if ( recursions >= MaxRecursions )
3333 {
34- throw new InfiniteLoopProtectionException ( $ "Inherited branch configuration caused { recursiveLevel } recursions. Aborting!") ;
34+ throw new InfiniteLoopProtectionException ( $ "Inherited branch configuration caused { recursions } recursions. Aborting!") ;
3535 }
3636
3737 var matchingBranches = configuration . GetConfigForBranch ( targetBranch . Name . WithoutRemote ) ;
@@ -51,7 +51,7 @@ private BranchConfig GetBranchConfigurationInternal(int recursiveLevel, IBranch
5151
5252 if ( matchingBranches . Increment == IncrementStrategy . Inherit )
5353 {
54- matchingBranches = InheritBranchConfiguration ( recursiveLevel , targetBranch , matchingBranches , currentCommit , configuration , excludedInheritBranches ) ;
54+ matchingBranches = InheritBranchConfiguration ( recursions , targetBranch , matchingBranches , currentCommit , configuration , excludedInheritBranches ) ;
5555 if ( matchingBranches . Name ! . IsEquivalentTo ( FallbackConfigName ) && matchingBranches . Increment == IncrementStrategy . Inherit )
5656 {
5757 // We tried, and failed to inherit, just fall back to patch
@@ -64,11 +64,11 @@ private BranchConfig GetBranchConfigurationInternal(int recursiveLevel, IBranch
6464 }
6565
6666 // 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 )
6868 {
6969 using ( this . log . IndentLog ( "Attempting to inherit branch configuration from parent branch" ) )
7070 {
71- recursiveLevel += 1 ;
71+ recursions += 1 ;
7272
7373 var excludedBranches = new [ ] { targetBranch } ;
7474 // 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
119119
120120 if ( possibleParents . Count == 1 )
121121 {
122- var branchConfig = GetBranchConfigurationInternal ( recursiveLevel , possibleParents [ 0 ] , currentCommit , configuration , excludedInheritBranches ) ;
122+ var branchConfig = GetBranchConfigurationInternal ( recursions , possibleParents [ 0 ] , currentCommit , configuration , excludedInheritBranches ) ;
123123 // If we have resolved a fallback config we should not return that we have got config
124124 if ( branchConfig . Name != FallbackConfigName )
125125 {
@@ -167,7 +167,7 @@ private BranchConfig InheritBranchConfiguration(int recursiveLevel, IBranch targ
167167 } ;
168168 }
169169
170- var inheritingBranchConfig = GetBranchConfigurationInternal ( recursiveLevel , chosenBranch , currentCommit , configuration , excludedInheritBranches ) ! ;
170+ var inheritingBranchConfig = GetBranchConfigurationInternal ( recursions , chosenBranch , currentCommit , configuration , excludedInheritBranches ) ! ;
171171 var configIncrement = inheritingBranchConfig . Increment ;
172172 if ( inheritingBranchConfig . Name ! . IsEquivalentTo ( FallbackConfigName ) && configIncrement == IncrementStrategy . Inherit )
173173 {
0 commit comments