Skip to content

Commit

Permalink
added test for GitTools#2340 scenario 1, branch created on tagged com…
Browse files Browse the repository at this point in the history
…mit should not consider the tag if it does not match to the current branch config
  • Loading branch information
Yannick Hein committed Jul 24, 2020
1 parent 507686e commit 44a6f4c
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,34 @@ public void BranchVersionHavePrecedenceOverTagVersionIfVersionGreaterThanTag()

fixture.AssertFullSemver("1.0.0-beta.1+0");
}

[Test]
public void BetaBranchCreatedButStillOnTaggedAlphaCommitShouldCreateBetaVersion()
{
// Arrange
var config = new Config
{
Branches =
{
{ "release", new BranchConfig { Tag = "beta" } },
{ "develop", new BranchConfig { Tag = "alpha" } }
}
};

// Act
using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
fixture.Checkout("develop");
fixture.MakeATaggedCommit("1.1.0-alpha.1"); // assuming this has been build as 1.1.0-alpha.1

fixture.BranchTo("release/1.1.0"); // about to be released, no additional empty commit in this scenario!
fixture.Checkout("release/1.1.0"); // still on the same commit, but another branch, choosing to build same code as beta now

// Assert
fixture.AssertFullSemver("1.1.0-beta.1", config); //will be 1.1.0-alpha.1, should be 1.1.0-beta.1. Tag is an "alpha" tag from develop branch, only "beta" tags should count when on release branch. If no beta tag found, build new beta version on release branch.

fixture.Checkout("develop"); // back to develop
fixture.AssertFullSemver("1.1.0-alpha.1", config); //will be 1.1.0-alpha.1 based on tag (as before)

}
}
}

0 comments on commit 44a6f4c

Please sign in to comment.