Skip to content

Commit 03dd7e4

Browse files
committed
Rename prevent-increment-when-tagged to prevent-increment-when-current-commit-tagged and update documentation.
1 parent 881758c commit 03dd7e4

File tree

43 files changed

+148
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+148
-138
lines changed

BREAKING_CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
* VersionInBranchName
5454
* TrunkBased
5555
* The initialization wizard has been removed.
56+
* On the `develop`, `release` and `hotfix` branch the introduced branch related property `prevent-increment-when-current-commit-tagged` has been set to `false` to get the incremented instead of the tagged semantic version.
5657
5758
## v5.0.0
5859

docs/input/docs/reference/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,9 @@ In a GitFlow-based repository, setting this option can have implications on the
805805
better version source proposed by the `MergeMessageBaseVersionStrategy`. For
806806
more details and an in-depth analysis, please see [the discussion][2506].
807807

808-
### prevent-increment-when-tagged
808+
### prevent-increment-when-current-commit-tagged
809809

810-
This branch related property can be used to control the behavior whether to take the incremented or the current tagged version.
810+
This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.
811811

812812
### label-number-pattern
813813

src/GitVersion.BuildAgents.Tests/Agents/BitBucketPipelinesTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private void AssertVariablesAreWrittenToFile(string propertyFile, string ps1File
147147

148148
var variableProvider = this.sp.GetRequiredService<IVariableProvider>();
149149

150-
var variables = variableProvider.GetVariablesFor(semanticVersion, new GitVersionConfiguration(), 0);
150+
var variables = variableProvider.GetVariablesFor(semanticVersion, EmptyConfigurationBuilder.New.Build(), 0);
151151

152152
this.buildServer.WithPropertyFile(propertyFile);
153153
this.buildServer.WithPowershellFile(ps1File);

src/GitVersion.BuildAgents.Tests/Agents/BuildServerBaseTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void BuildNumberIsFullSemVer()
3737
}
3838
};
3939

40-
var variables = this.buildServer.GetVariablesFor(semanticVersion, new GitVersionConfiguration(), 0);
40+
var variables = this.buildServer.GetVariablesFor(semanticVersion, EmptyConfigurationBuilder.New.Build(), 0);
4141
var buildAgent = this.sp.GetRequiredService<BuildAgent>();
4242
buildAgent.WriteIntegration(writes.Add, variables);
4343

src/GitVersion.BuildAgents.Tests/Agents/CodeBuildTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private void AssertVariablesAreWrittenToFile(string file)
8484

8585
var variableProvider = this.sp.GetRequiredService<IVariableProvider>();
8686

87-
var variables = variableProvider.GetVariablesFor(semanticVersion, new GitVersionConfiguration(), 0);
87+
var variables = variableProvider.GetVariablesFor(semanticVersion, EmptyConfigurationBuilder.New.Build(), 0);
8888

8989
this.buildServer.WithPropertyFile(file);
9090

src/GitVersion.BuildAgents.Tests/Agents/GitLabCiTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private void AssertVariablesAreWrittenToFile(string file)
6969

7070
var variableProvider = this.sp.GetRequiredService<IVariableProvider>();
7171

72-
var variables = variableProvider.GetVariablesFor(semanticVersion, new GitVersionConfiguration(), 0);
72+
var variables = variableProvider.GetVariablesFor(semanticVersion, EmptyConfigurationBuilder.New.Build(), 0);
7373

7474
this.buildServer.WithPropertyFile(file);
7575

src/GitVersion.BuildAgents.Tests/Agents/JenkinsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private void AssertVariablesAreWrittenToFile(string file)
136136

137137
var variableProvider = this.sp.GetRequiredService<IVariableProvider>();
138138

139-
var variables = variableProvider.GetVariablesFor(semanticVersion, new GitVersionConfiguration(), 0);
139+
var variables = variableProvider.GetVariablesFor(semanticVersion, EmptyConfigurationBuilder.New.Build(), 0);
140140

141141
this.buildServer.WithPropertyFile(file);
142142

src/GitVersion.Configuration.Tests/Configuration/ConfigurationExtensionsTests.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ public class ConfigurationExtensionsTests : TestBase
99
[Test]
1010
public void GetReleaseBranchConfigReturnsAllReleaseBranches()
1111
{
12-
var configuration = new GitVersionConfiguration
13-
{
14-
Branches = new Dictionary<string, BranchConfiguration>
15-
{
16-
{ "foo", new BranchConfiguration() },
17-
{ "bar", new BranchConfiguration { IsReleaseBranch = true } },
18-
{ "baz", new BranchConfiguration { IsReleaseBranch = true } }
19-
}
20-
};
12+
var configuration = EmptyConfigurationBuilder.New
13+
.WithBranch("foo", _ => _.WithRegularExpression("foo"))
14+
.WithBranch("bar", _ => _.WithRegularExpression("bar").WithIsReleaseBranch(true))
15+
.WithBranch("baz", _ => _.WithRegularExpression("baz").WithIsReleaseBranch(true))
16+
.Build();
2117

2218
var result = configuration.GetReleaseBranchConfiguration();
2319

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ branches:
2222
label: alpha
2323
increment: Minor
2424
prevent-increment-of-merged-branch-version: false
25-
prevent-increment-when-tagged: false
25+
prevent-increment-when-current-commit-tagged: false
2626
track-merge-target: true
2727
regex: ^dev(elop)?(ment)?$
2828
source-branches: []
@@ -50,7 +50,7 @@ branches:
5050
label: beta
5151
increment: None
5252
prevent-increment-of-merged-branch-version: true
53-
prevent-increment-when-tagged: false
53+
prevent-increment-when-current-commit-tagged: false
5454
track-merge-target: false
5555
regex: ^releases?[/-]
5656
source-branches:
@@ -96,7 +96,7 @@ branches:
9696
mode: ManualDeployment
9797
label: beta
9898
increment: Inherit
99-
prevent-increment-when-tagged: false
99+
prevent-increment-when-current-commit-tagged: false
100100
regex: ^hotfix(es)?[/-]
101101
source-branches:
102102
- release
@@ -139,7 +139,7 @@ mode: ContinuousDelivery
139139
label: '{BranchName}'
140140
increment: Inherit
141141
prevent-increment-of-merged-branch-version: false
142-
prevent-increment-when-tagged: true
142+
prevent-increment-when-current-commit-tagged: true
143143
track-merge-target: false
144144
track-merge-message: true
145145
commit-message-incrementing: Enabled

src/GitVersion.Configuration/BranchConfiguration.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ internal record BranchConfiguration : IBranchConfiguration
2222
[JsonPropertyDescription("Prevent increment of merged branch version.")]
2323
public bool? PreventIncrementOfMergedBranchVersion { get; internal set; }
2424

25-
[JsonPropertyName("prevent-increment-when-tagged")] // take-incremented-version
26-
[JsonPropertyDescription("Option to control which version should be taken for this branch. Can be.")]
27-
public bool? PreventIncrementWhenTagged { get; internal set; }
25+
[JsonPropertyName("prevent-increment-when-current-commit-tagged")]
26+
[JsonPropertyDescription("This branch related property controls the behvior whether to use the tagged (value set to true) or the incremented (value set to false) semantic version. Defaults to true.")]
27+
public bool? PreventIncrementWhenCurrentCommitTagged { get; internal set; }
2828

2929
[JsonPropertyName("label-number-pattern")]
3030
[JsonPropertyDescription($"The regular expression pattern to use to extract the number from the branch name. Defaults to '{ConfigurationConstants.DefaultLabelNumberPattern}'.")]
@@ -93,7 +93,8 @@ public virtual IBranchConfiguration Inherit(IBranchConfiguration configuration)
9393
Label = Label ?? configuration.Label,
9494
PreventIncrementOfMergedBranchVersion = PreventIncrementOfMergedBranchVersion
9595
?? configuration.PreventIncrementOfMergedBranchVersion,
96-
PreventIncrementWhenTagged = PreventIncrementWhenTagged ?? configuration.PreventIncrementWhenTagged,
96+
PreventIncrementWhenCurrentCommitTagged = PreventIncrementWhenCurrentCommitTagged
97+
?? configuration.PreventIncrementWhenCurrentCommitTagged,
9798
LabelNumberPattern = LabelNumberPattern ?? configuration.LabelNumberPattern,
9899
TrackMergeTarget = TrackMergeTarget ?? configuration.TrackMergeTarget,
99100
TrackMergeMessage = TrackMergeMessage ?? configuration.TrackMergeMessage,

0 commit comments

Comments
 (0)