diff --git a/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs b/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs index 4ebda3317b..5fef1447c6 100644 --- a/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs +++ b/src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs @@ -46,6 +46,20 @@ public void AllowNotHavingMaster() } } + [Test] + public void AllowHavingVariantsStartingWithMaster() + { + using (var fixture = new EmptyRepositoryFixture()) + { + fixture.Repository.MakeACommit(); + fixture.Repository.MakeATaggedCommit("1.0.0"); + fixture.Repository.MakeACommit(); + Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("masterfix")); + + fixture.AssertFullSemver("1.0.1-masterfix.1+1"); + } + } + [Test] public void AllowHavingMainInsteadOfMaster() { diff --git a/src/GitVersionCore/Configuration/Config.cs b/src/GitVersionCore/Configuration/Config.cs index a5d6dcecf8..4b822327e9 100644 --- a/src/GitVersionCore/Configuration/Config.cs +++ b/src/GitVersionCore/Configuration/Config.cs @@ -95,7 +95,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 {