Skip to content

Commit

Permalink
Implement when PreleaseLabel is empty, the PreleaseTag is generated c…
Browse files Browse the repository at this point in the history
…orrectly
  • Loading branch information
HHobeck committed Mar 30, 2023
1 parent 1cb9bb8 commit ae9cec8
Show file tree
Hide file tree
Showing 55 changed files with 1,814 additions and 1,005 deletions.
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 @@ -12,7 +12,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 @@ -39,6 +38,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 @@ -69,7 +69,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 @@ -124,7 +124,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 ae9cec8

Please sign in to comment.