Skip to content

Commit 7523043

Browse files
committed
Use the first matched branch configuration
This change causes GitVersion to allow multiple branch configurations to match the current branch, and instead of throwing an exception it will use the first matching configuration that was found.
1 parent 3bdcd89 commit 7523043

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit c
2525
ConfigurationProvider.ApplyBranchDefaults(config, branchConfig, "");
2626
return new KeyValuePair<string, BranchConfig>(string.Empty, branchConfig);
2727
}
28-
if (matchingBranches.Length == 1)
28+
else
2929
{
3030
var keyValuePair = matchingBranches[0];
3131
var branchConfiguration = keyValuePair.Value;
@@ -37,9 +37,6 @@ public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit c
3737

3838
return keyValuePair;
3939
}
40-
41-
const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
42-
throw new Exception(string.Format(format, currentBranch.FriendlyName, string.Join(", ", matchingBranches.Select(b => b.Key))));
4340
}
4441

4542
static KeyValuePair<string, BranchConfig>[] LookupBranchConfiguration([NotNull] Config config, [NotNull] Branch currentBranch)

0 commit comments

Comments
 (0)