Skip to content

Commit

Permalink
Added test that proves #2394 has been fixed
Browse files Browse the repository at this point in the history
Fixes #2394
  • Loading branch information
ni-fgenois committed Apr 4, 2022
1 parent 2d7ac5e commit 6496fd3
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using GitVersion.VersionCalculation;
using LibGit2Sharp;
using NUnit.Framework;
using Shouldly;

namespace GitVersion.Core.Tests.IntegrationTests;

Expand Down Expand Up @@ -225,6 +226,32 @@ public void MainVersioningContinuesCountingAfterMergingTheSameReleaseBranchMulti
fixture.AssertFullSemver("2.0.0+5");
}

[Test]
public void ShouldUseTagsAsVersionSourceWhenPossible()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeATaggedCommit("0.1.0");
fixture.Checkout(MainBranch);
fixture.Repository.CreateBranch("develop");
fixture.Checkout("develop");
fixture.MakeACommit("Feature commit 1");
fixture.BranchTo("release/0.2.0");
fixture.MakeACommit("Release commit 1");
fixture.Checkout(MainBranch);
fixture.MergeNoFF("release/0.2.0");
fixture.ApplyTag("0.2.0");

var tag = fixture.Repository.Head.Tip;

fixture.Checkout("develop");
fixture.MergeNoFF(MainBranch);

fixture.AssertFullSemver("0.3.0-alpha.1");

var version = fixture.GetVersion();
version.VersionSourceSha.ShouldBeEquivalentTo(tag.Sha);
}

[Test]
public void WhenReleaseBranchIsMergedIntoDevelopHighestVersionIsTakenWithIt()
{
Expand Down

0 comments on commit 6496fd3

Please sign in to comment.