Skip to content

Commit 5f30b8a

Browse files
authored
Merge pull request #978 from lerthe61/tagsVersioning
Version calculation should not use tags from not merged branch
2 parents 4a15005 + cbaa539 commit 5f30b8a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/GitVersionCore.Tests/IntegrationTests/OtherBranchScenarios.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using GitVersionCore.Tests;
33
using LibGit2Sharp;
44
using NUnit.Framework;
5+
using Shouldly;
56

67
[TestFixture]
78
public class OtherBranchScenarios
@@ -20,6 +21,7 @@ public void CanTakeVersionFromReleaseBranch()
2021
fixture.AssertFullSemver("2.0.0-alpha.1+0");
2122
}
2223
}
24+
2325
[Test]
2426
public void BranchesWithIllegalCharsShouldNotBeUsedInVersionNames()
2527
{
@@ -34,4 +36,25 @@ public void BranchesWithIllegalCharsShouldNotBeUsedInVersionNames()
3436
fixture.AssertFullSemver("1.0.4-issue-m-github-569.1+5");
3537
}
3638
}
39+
40+
[Test]
41+
public void ShouldNotGetVersionFromFeatureBranchIfNotMerged()
42+
{
43+
using (var fixture = new EmptyRepositoryFixture())
44+
{
45+
fixture.Repository.MakeATaggedCommit("1.0.0-unstable.0"); // initial commit in master
46+
47+
fixture.Repository.CreateBranch("feature");
48+
fixture.Repository.Checkout("feature");
49+
fixture.Repository.MakeATaggedCommit("1.0.1-feature.1");
50+
51+
fixture.Repository.Checkout("master");
52+
fixture.Repository.CreateBranch("develop");
53+
fixture.Repository.Checkout("develop");
54+
fixture.Repository.MakeACommit();
55+
56+
var version = fixture.GetVersion();
57+
version.SemVer.ShouldBe("1.0.0-unstable.1");
58+
}
59+
}
3760
}

0 commit comments

Comments
 (0)