Skip to content

Commit 881596b

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 fe9a964 commit 881596b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,8 @@ public static BranchConfig GetBranchConfiguration(Commit currentCommit, IReposit
1616
{
1717
var matchingBranches = LookupBranchConfiguration(config, currentBranch).ToArray();
1818

19-
if (matchingBranches.Length > 1)
20-
{
21-
const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
22-
throw new Exception(string.Format(format, currentBranch.FriendlyName, string.Join(", ", matchingBranches.Select(b => b.Name))));
23-
}
24-
2519
BranchConfig branchConfiguration;
26-
if (matchingBranches.Length == 1)
20+
if (matchingBranches.Length > 0)
2721
{
2822
branchConfiguration = matchingBranches[0];
2923
}

0 commit comments

Comments
 (0)