@@ -10,7 +10,7 @@ public class BranchConfigurationCalculator
10
10
{
11
11
public static KeyValuePair < string , BranchConfig > GetBranchConfiguration ( Commit currentCommit , IRepository repository , bool onlyEvaluateTrackedBranches , Config config , Branch currentBranch , IList < Branch > excludedInheritBranches = null )
12
12
{
13
- var matchingBranches = config . Branches . Where ( b => Regex . IsMatch ( currentBranch . Name , "^" + b . Key , RegexOptions . IgnoreCase ) ) . ToArray ( ) ;
13
+ var matchingBranches = LookupBranchConfiguration ( config , currentBranch ) ;
14
14
15
15
if ( matchingBranches . Length == 0 )
16
16
{
@@ -33,6 +33,11 @@ public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit c
33
33
throw new Exception ( string . Format ( format , currentBranch . Name , string . Join ( ", " , matchingBranches . Select ( b => b . Key ) ) ) ) ;
34
34
}
35
35
36
+ static KeyValuePair < string , BranchConfig > [ ] LookupBranchConfiguration ( Config config , Branch currentBranch )
37
+ {
38
+ return config . Branches . Where ( b => Regex . IsMatch ( currentBranch . Name , "^" + b . Key , RegexOptions . IgnoreCase ) ) . ToArray ( ) ;
39
+ }
40
+
36
41
static KeyValuePair < string , BranchConfig > InheritBranchConfiguration ( bool onlyEvaluateTrackedBranches , IRepository repository , Commit currentCommit , Branch currentBranch , KeyValuePair < string , BranchConfig > keyValuePair , BranchConfig branchConfiguration , Config config , IList < Branch > excludedInheritBranches )
37
42
{
38
43
Logger . WriteInfo ( "Attempting to inherit branch configuration from parent branch" ) ;
@@ -69,7 +74,11 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(bool onlyEv
69
74
}
70
75
if ( excludedInheritBranches == null )
71
76
{
72
- excludedInheritBranches = new List < Branch > ( ) ;
77
+ excludedInheritBranches = repository . Branches . Where ( b =>
78
+ {
79
+ var branchConfig = LookupBranchConfiguration ( config , b ) ;
80
+ return branchConfig . Length == 1 && branchConfig [ 0 ] . Value . Increment == IncrementStrategy . Inherit ;
81
+ } ) . ToList ( ) ;
73
82
}
74
83
excludedBranches . ToList ( ) . ForEach ( excludedInheritBranches . Add ) ;
75
84
0 commit comments