diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index 2b08740c39..99b3aba154 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -105,7 +105,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-] + regex: ^releases?[/-](?.+) source-branches: - develop - main @@ -153,7 +153,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-] + regex: ^hotfix(es)?[/-](?.+) source-branches: - release - main @@ -168,7 +168,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-] + regex: ^support[/-](?.+) source-branches: - main is-source-branch-for: [] @@ -209,7 +209,6 @@ is-source-branch-for: [] tracks-release-branches: false is-release-branch: false is-main-branch: false - ``` The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like: @@ -257,7 +256,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-] + regex: ^releases?[/-](?.+) source-branches: - main - release diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt index a043a75634..83c233ec89 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt @@ -54,7 +54,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-] + regex: ^releases?[/-](?.+) source-branches: - develop - main @@ -102,7 +102,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-] + regex: ^hotfix(es)?[/-](?.+) source-branches: - release - main @@ -117,7 +117,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-] + regex: ^support[/-](?.+) source-branches: - main is-source-branch-for: [] diff --git a/src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml b/src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml index a043a75634..83c233ec89 100644 --- a/src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml +++ b/src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml @@ -54,7 +54,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-] + regex: ^releases?[/-](?.+) source-branches: - develop - main @@ -102,7 +102,7 @@ branches: increment: Inherit prevent-increment: when-current-commit-tagged: false - regex: ^hotfix(es)?[/-] + regex: ^hotfix(es)?[/-](?.+) source-branches: - release - main @@ -117,7 +117,7 @@ branches: prevent-increment: of-merged-branch: true track-merge-target: false - regex: ^support[/-] + regex: ^support[/-](?.+) source-branches: - main is-source-branch-for: [] diff --git a/src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml b/src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml index 18dea546dd..48e1d6aabc 100644 --- a/src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml +++ b/src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml @@ -40,7 +40,7 @@ branches: of-merged-branch: true when-current-commit-tagged: false track-merge-target: false - regex: ^releases?[/-] + regex: ^releases?[/-](?.+) source-branches: - main - release diff --git a/src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs b/src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs index 133c19e407..1a17da8ae4 100644 --- a/src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs +++ b/src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs @@ -80,7 +80,7 @@ private TrunkBasedConfigurationBuilder() WithBranch(HotfixBranch.Name).WithConfiguration(new BranchConfiguration() { Increment = IncrementStrategy.Patch, - RegularExpression = "^hotfix(es)?[/-](?.+)", + RegularExpression = HotfixBranch.RegexPattern, SourceBranches = [ this.MainBranch.Name diff --git a/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs b/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs index 80be294775..e3998d6179 100644 --- a/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs +++ b/src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs @@ -36,27 +36,6 @@ private static GitFlowConfigurationBuilder GetConfigurationBuilder() => GitFlowC .WithSourceBranches("main") ); - [Test] - [Ignore("Support of multiple tunks are not implemented at the moment.")] - public void VerifyNonMainMainlineVersionIdenticalAsMain() - { - var configuration = GetConfigurationBuilder().Build(); - - using var fixture = new EmptyRepositoryFixture(); - fixture.Repository.MakeACommit("1"); - - fixture.BranchTo("feature/foo", "foo"); - fixture.MakeACommit("2 +semver: major"); - fixture.Checkout(MainBranch); - fixture.MergeNoFF("feature/foo"); - - fixture.AssertFullSemver("1.0.0", configuration); - - fixture.BranchTo("support/1.0", "support"); - - fixture.AssertFullSemver("1.0.0", configuration); - } - [Test] public void MergedFeatureBranchesToMainImpliesRelease() { diff --git a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs index b3a8ffa6ef..b64bb3d869 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs @@ -42,10 +42,10 @@ internal static class ConfigurationConstants public const string MainBranchRegex = "^master$|^main$"; public const string DevelopBranchRegex = "^dev(elop)?(ment)?$"; - public const string ReleaseBranchRegex = "^releases?[/-]"; + public const string ReleaseBranchRegex = "^releases?[/-](?.+)"; public const string FeatureBranchRegex = "^features?[/-](?.+)"; public const string PullRequestBranchRegex = @"^(pull|pull\-requests|pr)[/-]"; - public const string HotfixBranchRegex = "^hotfix(es)?[/-]"; - public const string SupportBranchRegex = "^support[/-]"; + public const string HotfixBranchRegex = "^hotfix(es)?[/-](?.+)"; + public const string SupportBranchRegex = "^support[/-](?.+)"; public const string UnknownBranchRegex = "(?.+)"; } diff --git a/src/GitVersion.Core/MergeMessage.cs b/src/GitVersion.Core/MergeMessage.cs index 76cb9bcd7f..d5d72b9112 100644 --- a/src/GitVersion.Core/MergeMessage.cs +++ b/src/GitVersion.Core/MergeMessage.cs @@ -7,16 +7,16 @@ namespace GitVersion; public class MergeMessage { - private static readonly IList DefaultFormats = new List - { + private static readonly IList DefaultFormats = [ new("Default", @"^Merge (branch|tag) '(?[^']*)'(?: into (?[^\s]*))*"), new("SmartGit", @"^Finish (?[^\s]*)(?: into (?[^\s]*))*"), new("BitBucketPull", @"^Merge pull request #(?\d+) (from|in) (?.*) from (?[^\s]*) to (?[^\s]*)"), new("BitBucketPullv7", @"^Pull request #(?\d+).*\r?\n\r?\nMerge in (?.*) from (?[^\s]*) to (?[^\s]*)"), new("BitBucketCloudPull", @"^Merged in (?[^\s]*) \(pull request #(?\d+)\)"), new("GitHubPull", @"^Merge pull request #(?\d+) (from|in) (?:[^\s\/]+\/)?(?[^\s]*)(?: into (?[^\s]*))*"), - new("RemoteTracking", @"^Merge remote-tracking branch '(?[^\s]*)'(?: into (?[^\s]*))*") - }; + new("RemoteTracking", @"^Merge remote-tracking branch '(?[^\s]*)'(?: into (?[^\s]*))*"), + new("AzureDevOpsPull", @"^Merge pull request (?\d+) from (?[^\s]*) into (?[^\s]*)") + ]; public MergeMessage(string mergeMessage, IGitVersionConfiguration configuration) {