Skip to content

Commit

Permalink
Merge pull request #3447 from HHobeck/feature/2347_PromoteTagEvenIfNa…
Browse files Browse the repository at this point in the history
…meIsEmpty

Implement when PreleaseLabel is empty, the PreleaseTag is generated correctly
  • Loading branch information
arturcic committed Apr 6, 2023
2 parents 03271d6 + 25c17c8 commit 8caa9d2
Show file tree
Hide file tree
Showing 56 changed files with 1,830 additions and 1,009 deletions.
1 change: 1 addition & 0 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* The process of increasing the version with bump message when `CommitMessageIncrementing` is enabled and increment strategy is `None` has been changed.
* A new configuration property with name `version-in-branch-pattern` has been introduced. This setting only applies on branches where the option `is-release-branch` is set to `true`. Please notice that the branch name needs to be defined after the version number by default (instead of `support/lts-2.0.0` please name the branch like `support/2.0.0-lts`).
* The `is-release-branch` property of the `hotfix` branch setting has been changed from `false` to `true`. If present the hotfix number will be considered now by default.
* In the GitHub and the Git Flow workflows the `label` property is by default set to an empty string on the `main` branch. This yields to a pre-release version on `main` with an empty tag. Instead of for instance `1.0.1+46` GitVersion generates the full semantic version `1.0.1-46` instead. This behavior can be changed to generate only stable versions (no pre-release version) with setting the label to `null` (Please keep in mind that the `label` property on root needs to be set to `null` as well, otherwise the fallback applies). This change is caused by issue #2347.

## v5.0.0

Expand Down
4 changes: 2 additions & 2 deletions src/GitVersion.App.Tests/JsonOutputOnBuildServerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void BeingOnBuildServerWithOutputJsonDoesNotFail()
var result = GitVersionHelper.ExecuteIn(fixture.LocalRepositoryFixture.RepositoryPath, arguments: " /output json /output buildserver", environments: env);

result.ExitCode.ShouldBe(0);
const string expectedVersion = "0.0.1+5";
const string expectedVersion = "0.0.1-5";
result.Output.ShouldContain($"##teamcity[buildNumber '{expectedVersion}']");
result.OutputVariables.ShouldNotBeNull();
result.OutputVariables.FullSemVer.ShouldBeEquivalentTo(expectedVersion);
Expand All @@ -53,7 +53,7 @@ public void BeingOnBuildServerWithOutputJsonAndOutputFileDoesNotFail(string outp
var result = GitVersionHelper.ExecuteIn(fixture.LocalRepositoryFixture.RepositoryPath, arguments: $" /output json /output buildserver /output file /outputfile {outputFile}", environments: env);

result.ExitCode.ShouldBe(0);
const string expectedVersion = "0.0.1+5";
const string expectedVersion = "0.0.1-5";
result.Output.ShouldContain($"##teamcity[buildNumber '{expectedVersion}']");
result.OutputVariables.ShouldNotBeNull();
result.OutputVariables.FullSemVer.ShouldBeEquivalentTo(expectedVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ update-build-number: true
semantic-version-format: Strict
branches:
develop:
mode: ContinuousDeployment
label: alpha
increment: Minor
prevent-increment-of-merged-branch-version: false
Expand All @@ -40,6 +39,7 @@ branches:
is-mainline: true
pre-release-weight: 55000
release:
mode: ContinuousDelivery
label: beta
increment: None
prevent-increment-of-merged-branch-version: true
Expand Down Expand Up @@ -70,7 +70,7 @@ branches:
is-source-branch-for: []
pre-release-weight: 30000
pull-request:
mode: ContinuousDelivery
mode: ContinuousDeployment
label: PullRequest
increment: Inherit
label-number-pattern: '[/-](?<number>\d+)'
Expand Down Expand Up @@ -126,7 +126,7 @@ branches:
is-source-branch-for: []
ignore:
sha: []
mode: ContinuousDelivery
mode: ContinuousDeployment
label: '{BranchName}'
increment: Inherit
prevent-increment-of-merged-branch-version: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using GitVersion.Extensions;
using GitVersion.Helpers;
using GitVersion.Logging;
using GitVersion.VersionCalculation;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

Expand Down Expand Up @@ -33,21 +34,26 @@ public void Setup()
[Test]
public void OverwritesDefaultsWithProvidedConfig()
{
var defaultConfig = this.configurationProvider.ProvideForDirectory(this.repoPath);
var defaultConfiguration = this.configurationProvider.ProvideForDirectory(this.repoPath);
const string text = @"
next-version: 2.0.0
branches:
develop:
mode: ContinuousDeployment
increment: Major
mode: ContinuousDelivery
label: dev";
SetupConfigFileContent(text);
var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath);

configuration.NextVersion.ShouldBe("2.0.0");
configuration.Branches.ShouldNotBeNull();
configuration.Branches["develop"].Increment.ShouldBe(defaultConfig.Branches["develop"].Increment);
configuration.Branches["develop"].VersioningMode.ShouldBe(defaultConfig.Branches["develop"].VersioningMode);
configuration.Branches["develop"].Label.ShouldBe("dev");

var developConfiguration = configuration.Branches["develop"];
developConfiguration.Increment.ShouldBe(IncrementStrategy.Major);
developConfiguration.Increment.ShouldNotBe(defaultConfiguration.Branches["develop"].Increment);
developConfiguration.VersioningMode.ShouldBe(VersioningMode.ContinuousDelivery);
developConfiguration.VersioningMode.ShouldNotBe(defaultConfiguration.Branches["develop"].VersioningMode);
developConfiguration.Label.ShouldBe("dev");
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public void Cleanup()

// Note: use same name twice to see if changing commits works on same (cached) repository
[NonParallelizable]
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "efddf2f92c539a9c27f1904d952dcab8fb955f0e", "5.8.2+56")]
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "2dc142a4a4df77db61a00d9fb7510b18b3c2c85a", "5.8.2+47")]
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "efddf2f92c539a9c27f1904d952dcab8fb955f0e", "5.8.2-56")]
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "2dc142a4a4df77db61a00d9fb7510b18b3c2c85a", "5.8.2-47")]
public void FindsVersionInDynamicRepo(string name, string url, string targetBranch, string commitId, string expectedFullSemVer)
{
var root = PathHelper.Combine(this.workDirectory, name);
Expand Down
Loading

0 comments on commit 8caa9d2

Please sign in to comment.