Skip to content
Merged
14 changes: 7 additions & 7 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ If you have branch specific configuration upgrading to v4 will force you to upgr
```yaml
branches:
master:
regex: master
regex: ^master
mode: ContinuousDelivery
tag: ''
increment: Patch
Expand All @@ -198,7 +198,7 @@ branches:
tracks-release-branches: false
is-release-branch: false
release:
regex: releases?[/-]
regex: ^releases?[/-]
mode: ContinuousDelivery
tag: beta
increment: Patch
Expand All @@ -207,7 +207,7 @@ branches:
tracks-release-branches: false
is-release-branch: true
feature:
regex: features?[/-]
regex: ^features?[/-]
mode: ContinuousDelivery
tag: useBranchName
increment: Inherit
Expand All @@ -216,7 +216,7 @@ branches:
tracks-release-branches: false
is-release-branch: false
pull-request:
regex: (pull|pull\-requests|pr)[/-]
regex: ^(pull|pull\-requests|pr)[/-]
mode: ContinuousDelivery
tag: PullRequest
increment: Inherit
Expand All @@ -226,7 +226,7 @@ branches:
tracks-release-branches: false
is-release-branch: false
hotfix:
regex: hotfix(es)?[/-]
regex: ^hotfix(es)?[/-]
mode: ContinuousDelivery
tag: beta
increment: Patch
Expand All @@ -235,7 +235,7 @@ branches:
tracks-release-branches: false
is-release-branch: false
support:
regex: support[/-]
regex: ^support[/-]
mode: ContinuousDelivery
tag: ''
increment: Patch
Expand All @@ -244,7 +244,7 @@ branches:
tracks-release-branches: false
is-release-branch: false
develop:
regex: dev(elop)?(ment)?$
regex: ^dev(elop)?(ment)?$
mode: ContinuousDeployment
tag: unstable
increment: Minor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ branches:
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
regex: dev(elop)?(ment)?$
regex: ^dev(elop)?(ment)?$
source-branches: []
tracks-release-branches: true
is-release-branch: false
Expand All @@ -29,7 +29,7 @@ branches:
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: master$
regex: ^master$
source-branches:
- develop
- release
Expand All @@ -42,7 +42,7 @@ branches:
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: releases?[/-]
regex: ^releases?[/-]
source-branches:
- develop
- master
Expand All @@ -57,7 +57,7 @@ branches:
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
regex: features?[/-]
regex: ^features?[/-]
source-branches:
- develop
- master
Expand All @@ -75,7 +75,7 @@ branches:
prevent-increment-of-merged-branch-version: false
tag-number-pattern: '[/-](?<number>\d+)'
track-merge-target: false
regex: (pull|pull\-requests|pr)[/-]
regex: ^(pull|pull\-requests|pr)[/-]
source-branches:
- develop
- master
Expand All @@ -92,7 +92,7 @@ branches:
increment: Patch
prevent-increment-of-merged-branch-version: false
track-merge-target: false
regex: hotfix(es)?[/-]
regex: ^hotfix(es)?[/-]
source-branches:
- develop
- master
Expand All @@ -106,7 +106,7 @@ branches:
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: support[/-]
regex: ^support[/-]
source-branches:
- master
tracks-release-branches: false
Expand Down
25 changes: 23 additions & 2 deletions src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using GitTools.Testing;
using GitTools.Testing;
using GitVersion;
using GitVersionCore.Tests;
using LibGit2Sharp;
Expand Down Expand Up @@ -183,4 +183,25 @@ public void InheritVersionFromReleaseBranch()
fixture.AssertFullSemver("2.1.0-MyFeature.1+5");
}
}
}

[Test]
public void WhenMultipleDevelopBranchesExistAndCurrentBranchHasIncrementInheritPolicyAndCurrentCommitIsAMerge()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeATaggedCommit("1.0.0");
fixture.Repository.CreateBranch("bob_develop");
fixture.Repository.CreateBranch("develop");
fixture.Repository.CreateBranch("feature/x");

Commands.Checkout(fixture.Repository, "develop");
fixture.Repository.MakeACommit();

Commands.Checkout(fixture.Repository, "feature/x");
fixture.Repository.MakeACommit();
fixture.Repository.MergeNoFF("develop");

fixture.AssertFullSemver("1.0.1-x.1+3");
}
}
}
2 changes: 1 addition & 1 deletion src/GitVersionCore/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public BranchConfig GetConfigForBranch(string branchName)
{
if (branchName == null) throw new ArgumentNullException(nameof(branchName));
var matches = Branches
.Where(b => Regex.IsMatch(branchName, "^" + b.Value.Regex, RegexOptions.IgnoreCase));
.Where(b => Regex.IsMatch(branchName, b.Value.Regex, RegexOptions.IgnoreCase));

try
{
Expand Down
14 changes: 7 additions & 7 deletions src/GitVersionCore/Configuration/ConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public class ConfigurationProvider
public const string DefaultConfigFileName = "GitVersion.yml";
public const string ObsoleteConfigFileName = "GitVersionConfig.yaml";

public const string ReleaseBranchRegex = "releases?[/-]";
public const string FeatureBranchRegex = "features?[/-]";
public const string PullRequestRegex = @"(pull|pull\-requests|pr)[/-]";
public const string HotfixBranchRegex = "hotfix(es)?[/-]";
public const string SupportBranchRegex = "support[/-]";
public const string DevelopBranchRegex = "dev(elop)?(ment)?$";
public const string MasterBranchRegex = "master$";
public const string ReleaseBranchRegex = "^releases?[/-]";
public const string FeatureBranchRegex = "^features?[/-]";
public const string PullRequestRegex = @"^(pull|pull\-requests|pr)[/-]";
public const string HotfixBranchRegex = "^hotfix(es)?[/-]";
public const string SupportBranchRegex = "^support[/-]";
public const string DevelopBranchRegex = "^dev(elop)?(ment)?$";
public const string MasterBranchRegex = "^master$";
public const string MasterBranchKey = "master";
public const string ReleaseBranchKey = "release";
public const string FeatureBranchKey = "feature";
Expand Down
3 changes: 2 additions & 1 deletion src/GitVersionCore/Configuration/LegacyConfigNotifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class LegacyConfigNotifier
{ConfigurationProvider.ReleaseBranchRegex, ConfigurationProvider.ReleaseBranchKey},
{ConfigurationProvider.SupportBranchRegex, ConfigurationProvider.SupportBranchKey},
{ConfigurationProvider.PullRequestRegex, ConfigurationProvider.PullRequestBranchKey},
{"release[/-]", ConfigurationProvider.ReleaseBranchKey},
{"dev(elop)?(ment)?$", ConfigurationProvider.DevelopBranchKey },
{"release[/-]", ConfigurationProvider.ReleaseBranchKey },
{"hotfix[/-]", ConfigurationProvider.HotfixBranchKey },
{"feature(s)?[/-]", ConfigurationProvider.FeatureBranchKey },
{"feature[/-]", ConfigurationProvider.FeatureBranchKey }
Expand Down