Skip to content

Commit 66859e0

Browse files
authored
Merge pull request #4796 from HHobeck/hotfix/4795-reads-tag-from-other-branch
fix: tagged version from the main and release branch should be considered
2 parents 71dda90 + ddfa31f commit 66859e0

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/GitVersion.Core.Tests/IntegrationTests/DevelopScenarios.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,4 +554,27 @@ public void PreventDecrementationOfVersionsOnTheMainBranch()
554554
// ✅ succeeds as expected
555555
fixture.AssertFullSemver("1.0.0", configurationBuilder.Build());
556556
}
557+
558+
/// <summary>
559+
/// "track-merge-target: false" reads tag from other branch #4795
560+
/// (see https://github.com/GitTools/GitVersion/issues/4795)
561+
/// </summary>
562+
[Test]
563+
public void TaggedVersionFromTheMainBranchShouldBeConsideredEvenIfItIsNewer()
564+
{
565+
using var fixture = new EmptyRepositoryFixture("main");
566+
567+
var configurationBuilder = GitFlowConfigurationBuilder.New;
568+
569+
fixture.MakeATaggedCommit("1.1.1");
570+
fixture.BranchTo("develop");
571+
fixture.MakeACommit();
572+
fixture.MergeNoFF("main");
573+
fixture.ApplyTag("9.9.9");
574+
fixture.Checkout("develop");
575+
fixture.MakeACommit();
576+
577+
// ✅ succeeds as expected
578+
fixture.AssertFullSemver("9.10.0-alpha.1", configurationBuilder.Build());
579+
}
557580
}

src/GitVersion.Core/Core/TaggedSemanticVersionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ IEnumerable<IEnumerable<CommitSemanticVersion>> GetElements()
5555
{
5656
yield return GetTaggedSemanticVersionsOfMainBranchesInternal(
5757
configuration: configuration,
58-
notOlderThan: notOlderThan,
58+
notOlderThan: null,
5959
label: label,
6060
excludeBranches: branch
6161
);
@@ -65,7 +65,7 @@ IEnumerable<IEnumerable<CommitSemanticVersion>> GetElements()
6565
{
6666
yield return GetTaggedSemanticVersionsOfReleaseBranchesInternal(
6767
configuration: configuration,
68-
notOlderThan: notOlderThan,
68+
notOlderThan: null,
6969
label: label,
7070
excludeBranches: branch
7171
);

0 commit comments

Comments
 (0)