Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement when PreleaseLabel is empty, the PreleaseTag is generated correctly #3447

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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