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

Pre-release label in git tag #1600

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,15 @@ public void PreventDecrementationOfVersionsOnTheMainBranch()
// ✅ succeeds as expected
fixture.AssertFullSemver("1.0.0", configurationBuilder.Build());
}

[Test]
public void ShouldProvideTheCorrectVersionEvenIfPreReleaseLabelExistsInTheGitTag()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.ApplyTag("1.0.0-oreo.1");
fixture.BranchTo("develop");
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.1.0-alpha.1");
}
}
23 changes: 23 additions & 0 deletions src/GitVersion.Core.Tests/IntegrationTests/MainScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,27 @@ public void TrackMergeMessageShouldBeConsideredOnTheMainBranch(bool trackMergeMe
// ✅ succeeds as expected
fixture.AssertFullSemver(expectedSemanticVersion, configuration);
}

[Test]
public void ShouldProvideTheCorrectVersionEvenIfPreReleaseLabelExistsInTheGitTag()
{
var configuration = GitFlowConfigurationBuilder.New
.WithSemanticVersionFormat(SemanticVersionFormat.Loose)
.WithNextVersion("5.0")
.WithBranch("main",
branchBuilder => branchBuilder.WithLabel("beta")
.WithIncrement(IncrementStrategy.Patch)
.WithVersioningMode(VersioningMode.ContinuousDeployment))
.Build();

using EmptyRepositoryFixture fixture = new("main");
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("5.0.0-beta.0", configuration); // why not "5.0.0-beta.1"?
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("5.0.0-beta.1", configuration);
fixture.Repository.MakeATaggedCommit("v5.0.0-rc.1");
fixture.AssertFullSemver("5.0.0-rc.1", configuration);
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("5.0.1-beta.1", configuration); // test fails here, it generates "5.0.0-beta.1" which is not unique and lower than "5.0.0-rc.1"
}
}