From 47753c559cf65eef9e85e433218026b077e95471 Mon Sep 17 00:00:00 2001 From: Mario Rosa Date: Wed, 31 Jul 2024 12:18:06 -0400 Subject: [PATCH 1/2] Add default config test case for feature branch label --- .../IntegrationTests/FeatureBranchScenarios.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs index 0f2f64c1ff..c0da0e2918 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/FeatureBranchScenarios.cs @@ -185,6 +185,7 @@ public void CanUseBranchNameOffAReleaseBranch() [TestCase("alpha", "JIRA-123", "^features?[/-](?.+)", "alpha")] [TestCase($"alpha.{ConfigurationConstants.BranchNamePlaceholder}", "JIRA-123", "^features?[/-](?.+)", "alpha.JIRA-123")] [TestCase("{BranchName}-of-task-number-{TaskNumber}", "4711_this-is-a-feature", "^features?[/-](?\\d+)_(?.+)", "this-is-a-feature-of-task-number-4711")] + [TestCase("{BranchName}", "4711_this-is-a-feature", "^features?[/-](?.+)", "4711-this-is-a-feature")] public void ShouldUseConfiguredLabel(string label, string featureName, string regularExpression, string preReleaseLabelName) { var configuration = GitFlowConfigurationBuilder.New From 46b00279a97dcea585fc2e9c87fd47078e09d0a3 Mon Sep 17 00:00:00 2001 From: Mario Rosa Date: Wed, 31 Jul 2024 12:23:03 -0400 Subject: [PATCH 2/2] replace any underscores that came in through group matches --- src/GitVersion.Core/Extensions/ConfigurationExtensions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs index f580c31840..66686ba81b 100644 --- a/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs +++ b/src/GitVersion.Core/Extensions/ConfigurationExtensions.cs @@ -103,6 +103,8 @@ public static bool IsReleaseBranch(this IGitVersionConfiguration configuration, { label = label.Replace("{" + groupName + "}", match.Groups[groupName].Value); } + + label = label.Replace('_', '-'); } }