-
Notifications
You must be signed in to change notification settings - Fork 654
Changing hardcoded master/develop regex #1259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing hardcoded master/develop regex #1259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Just a couple of minor changes and this looks mergeable!
@@ -109,8 +109,8 @@ static BranchConfig InheritBranchConfiguration(GitVersionContext context, Branch | |||
else | |||
errorMessage = "Failed to inherit Increment branch configuration, ended up with: " + string.Join(", ", possibleParents.Select(p => p.FriendlyName)); | |||
|
|||
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, "^develop", RegexOptions.IgnoreCase) | |||
|| Regex.IsMatch(b.FriendlyName, "master$", RegexOptions.IgnoreCase)); | |||
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, config.Branches[ConfigurationProvider.DevelopBranchKey].Regex, RegexOptions.IgnoreCase) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please extract this to a developBranchRegex
variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, "^develop", RegexOptions.IgnoreCase) | ||
|| Regex.IsMatch(b.FriendlyName, "master$", RegexOptions.IgnoreCase)); | ||
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, config.Branches[ConfigurationProvider.DevelopBranchKey].Regex, RegexOptions.IgnoreCase) | ||
|| Regex.IsMatch(b.FriendlyName, config.Branches[ConfigurationProvider.MasterBranchKey].Regex, RegexOptions.IgnoreCase)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please extract this to a masterBranchRegex
variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if what I did isn't what you meant.
…iens/GitVersion into feature/fix_fallback_branches
Thanks! What nuget package will this be part of?
…On Wed, Jul 12, 2017, 5:13 PM Asbjørn Ulsberg ***@***.***> wrote:
***@***.**** approved this pull request.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1259 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB3J_Bj8YFqNh8THibhN1JQeVdQUfEZlks5sNWESgaJpZM4OWEkF>
.
|
I encountered an issue where in a repository without a master or develop branch if we change the regex for master and develop to point to branches which do exist (and are used as master and develop branches) if there are no tags in the repo gitversion throws the following
This fix changes the fallback to use the regex in the config instead of using a hardcoded regex.