Skip to content

Commit 33b4af4

Browse files
author
Yannick Hein
committed
added test for GitTools#2340 scenario 1, branch created on tagged commit should not consider the tag if it does not match to the current branch config
1 parent 507686e commit 33b4af4

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/GitVersionCore.Tests/IntegrationTests/BranchWithoutCommitScenarios.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,34 @@ public void BranchVersionHavePrecedenceOverTagVersionIfVersionGreaterThanTag()
3636

3737
fixture.AssertFullSemver("1.0.0-beta.1+0");
3838
}
39+
40+
[Test]
41+
public void BetaBranchCreatedButStillOnTaggedAlphaCommitShouldCreateBetaVersion()
42+
{
43+
// Arrange
44+
var config = new Config
45+
{
46+
Branches =
47+
{
48+
{ "release", new BranchConfig { Tag = "beta" } },
49+
{ "develop", new BranchConfig { Tag = "alpha" } }
50+
}
51+
};
52+
53+
// Act
54+
using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
55+
fixture.Checkout("develop");
56+
fixture.MakeATaggedCommit("1.1.0-alpha.1"); // assuming this has been build as 1.1.0-alpha.1
57+
58+
fixture.BranchTo("release/1.1.0"); // about to be released, no additional empty commit in this scenario!
59+
fixture.Checkout("release/1.1.0"); // still on the same commit, but another branch, choosing to build same code as beta now
60+
61+
// Assert
62+
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.
63+
64+
fixture.Checkout("develop"); // back to develop
65+
fixture.AssertFullSemver("1.1.0-alpha.1", config); //will be 1.1.0-alpha.1 based on tag (as before)
66+
67+
}
3968
}
4069
}

0 commit comments

Comments
 (0)