Skip to content

Commit ff3e1a2

Browse files
committed
Integrate code review remarks from arturcic
1 parent fe27454 commit ff3e1a2

File tree

8 files changed

+17
-38
lines changed

8 files changed

+17
-38
lines changed

docs/input/docs/reference/configuration.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ branches:
105105
of-merged-branch: true
106106
when-current-commit-tagged: false
107107
track-merge-target: false
108-
regex: ^releases?[/-]
108+
regex: ^releases?[/-](?<BranchName>.+)
109109
source-branches:
110110
- develop
111111
- main
@@ -153,7 +153,7 @@ branches:
153153
increment: Inherit
154154
prevent-increment:
155155
when-current-commit-tagged: false
156-
regex: ^hotfix(es)?[/-]
156+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
157157
source-branches:
158158
- release
159159
- main
@@ -168,7 +168,7 @@ branches:
168168
prevent-increment:
169169
of-merged-branch: true
170170
track-merge-target: false
171-
regex: ^support[/-]
171+
regex: ^support[/-](?<BranchName>.+)
172172
source-branches:
173173
- main
174174
is-source-branch-for: []
@@ -209,7 +209,6 @@ is-source-branch-for: []
209209
tracks-release-branches: false
210210
is-release-branch: false
211211
is-main-branch: false
212-
213212
```
214213

215214
The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
@@ -257,7 +256,7 @@ branches:
257256
of-merged-branch: true
258257
when-current-commit-tagged: false
259258
track-merge-target: false
260-
regex: ^releases?[/-]
259+
regex: ^releases?[/-](?<BranchName>.+)
261260
source-branches:
262261
- main
263262
- release

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ branches:
5454
of-merged-branch: true
5555
when-current-commit-tagged: false
5656
track-merge-target: false
57-
regex: ^releases?[/-]
57+
regex: ^releases?[/-](?<BranchName>.+)
5858
source-branches:
5959
- develop
6060
- main
@@ -102,7 +102,7 @@ branches:
102102
increment: Inherit
103103
prevent-increment:
104104
when-current-commit-tagged: false
105-
regex: ^hotfix(es)?[/-]
105+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
106106
source-branches:
107107
- release
108108
- main
@@ -117,7 +117,7 @@ branches:
117117
prevent-increment:
118118
of-merged-branch: true
119119
track-merge-target: false
120-
regex: ^support[/-]
120+
regex: ^support[/-](?<BranchName>.+)
121121
source-branches:
122122
- main
123123
is-source-branch-for: []

src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ branches:
5454
of-merged-branch: true
5555
when-current-commit-tagged: false
5656
track-merge-target: false
57-
regex: ^releases?[/-]
57+
regex: ^releases?[/-](?<BranchName>.+)
5858
source-branches:
5959
- develop
6060
- main
@@ -102,7 +102,7 @@ branches:
102102
increment: Inherit
103103
prevent-increment:
104104
when-current-commit-tagged: false
105-
regex: ^hotfix(es)?[/-]
105+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
106106
source-branches:
107107
- release
108108
- main
@@ -117,7 +117,7 @@ branches:
117117
prevent-increment:
118118
of-merged-branch: true
119119
track-merge-target: false
120-
regex: ^support[/-]
120+
regex: ^support[/-](?<BranchName>.+)
121121
source-branches:
122122
- main
123123
is-source-branch-for: []

src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ branches:
4040
of-merged-branch: true
4141
when-current-commit-tagged: false
4242
track-merge-target: false
43-
regex: ^releases?[/-]
43+
regex: ^releases?[/-](?<BranchName>.+)
4444
source-branches:
4545
- main
4646
- release

src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private TrunkBasedConfigurationBuilder()
8080
WithBranch(HotfixBranch.Name).WithConfiguration(new BranchConfiguration()
8181
{
8282
Increment = IncrementStrategy.Patch,
83-
RegularExpression = "^hotfix(es)?[/-](?<BranchName>.+)",
83+
RegularExpression = HotfixBranch.RegexPattern,
8484
SourceBranches =
8585
[
8686
this.MainBranch.Name

src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs

-21
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@ private static GitFlowConfigurationBuilder GetConfigurationBuilder() => GitFlowC
3636
.WithSourceBranches("main")
3737
);
3838

39-
[Test]
40-
[Ignore("Support of multiple tunks are not implemented at the moment.")]
41-
public void VerifyNonMainMainlineVersionIdenticalAsMain()
42-
{
43-
var configuration = GetConfigurationBuilder().Build();
44-
45-
using var fixture = new EmptyRepositoryFixture();
46-
fixture.Repository.MakeACommit("1");
47-
48-
fixture.BranchTo("feature/foo", "foo");
49-
fixture.MakeACommit("2 +semver: major");
50-
fixture.Checkout(MainBranch);
51-
fixture.MergeNoFF("feature/foo");
52-
53-
fixture.AssertFullSemver("1.0.0", configuration);
54-
55-
fixture.BranchTo("support/1.0", "support");
56-
57-
fixture.AssertFullSemver("1.0.0", configuration);
58-
}
59-
6039
[Test]
6140
public void MergedFeatureBranchesToMainImpliesRelease()
6241
{

src/GitVersion.Core/Configuration/ConfigurationConstants.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ internal static class ConfigurationConstants
4242

4343
public const string MainBranchRegex = "^master$|^main$";
4444
public const string DevelopBranchRegex = "^dev(elop)?(ment)?$";
45-
public const string ReleaseBranchRegex = "^releases?[/-]";
45+
public const string ReleaseBranchRegex = "^releases?[/-](?<BranchName>.+)";
4646
public const string FeatureBranchRegex = "^features?[/-](?<BranchName>.+)";
4747
public const string PullRequestBranchRegex = @"^(pull|pull\-requests|pr)[/-]";
48-
public const string HotfixBranchRegex = "^hotfix(es)?[/-]";
49-
public const string SupportBranchRegex = "^support[/-]";
48+
public const string HotfixBranchRegex = "^hotfix(es)?[/-](?<BranchName>.+)";
49+
public const string SupportBranchRegex = "^support[/-](?<BranchName>.+)";
5050
public const string UnknownBranchRegex = "(?<BranchName>.+)";
5151
}

src/GitVersion.Core/MergeMessage.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class MergeMessage
1515
new("BitBucketPullv7", @"^Pull request #(?<PullRequestNumber>\d+).*\r?\n\r?\nMerge in (?<Source>.*) from (?<SourceBranch>[^\s]*) to (?<TargetBranch>[^\s]*)"),
1616
new("BitBucketCloudPull", @"^Merged in (?<SourceBranch>[^\s]*) \(pull request #(?<PullRequestNumber>\d+)\)"),
1717
new("GitHubPull", @"^Merge pull request #(?<PullRequestNumber>\d+) (from|in) (?:[^\s\/]+\/)?(?<SourceBranch>[^\s]*)(?: into (?<TargetBranch>[^\s]*))*"),
18-
new("RemoteTracking", @"^Merge remote-tracking branch '(?<SourceBranch>[^\s]*)'(?: into (?<TargetBranch>[^\s]*))*")
18+
new("RemoteTracking", @"^Merge remote-tracking branch '(?<SourceBranch>[^\s]*)'(?: into (?<TargetBranch>[^\s]*))*"),
19+
new("AzureDevOpsPull", @"^Merge pull request (?<PullRequestNumber>\d+) from (?<SourceBranch>[^\s]*) into (?<TargetBranch>[^\s]*)")
1920
};
2021

2122
public MergeMessage(string mergeMessage, IGitVersionConfiguration configuration)

0 commit comments

Comments
 (0)