Skip to content

Commit 29cb260

Browse files
authored
Merge pull request #1259 from pwiens/feature/fix_fallback_branches
Changing hardcoded master/develop regex
2 parents 7db5467 + be16ab8 commit 29cb260

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/GitVersionCore/BranchConfigurationCalculator.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch
109109
else
110110
errorMessage = "Failed to inherit Increment branch configuration, ended up with: " + string.Join(", ", possibleParents.Select(p => p.FriendlyName));
111111

112-
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, "^develop", RegexOptions.IgnoreCase)
113-
|| Regex.IsMatch(b.FriendlyName, "master$", RegexOptions.IgnoreCase));
112+
var developBranchRegex = config.Branches[ConfigurationProvider.DevelopBranchKey].Regex;
113+
var masterBranchRegex = config.Branches[ConfigurationProvider.MasterBranchKey].Regex;
114+
115+
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, developBranchRegex, RegexOptions.IgnoreCase)
116+
|| Regex.IsMatch(b.FriendlyName, masterBranchRegex, RegexOptions.IgnoreCase));
114117
if (chosenBranch == null)
115118
{
116119
// TODO We should call the build server to generate this exception, each build server works differently

0 commit comments

Comments
 (0)