Skip to content

[Bug] track-merge-changes produces unexpected result when combining hotfix and support branches #3052

Closed
@Crown0815

Description

@Crown0815

Describe the bug

It appears that track-merge-changes does not work when combining hotfix and support branches. I have the following test

[Test]
public void MyTest()
{
    var config = new Config();
    config.Branches.Add("hotfix", new BranchConfig
    {
        TrackMergeTarget = true,
    });

    using var fixture = new EmptyRepositoryFixture();
    fixture.Repository.MakeACommit();
    fixture.Checkout(MainBranch);
    fixture.Repository.ApplyTag("1.7.0");
    
    fixture.BranchTo("hotfix/1.7");
    fixture.Repository.MakeCommits(1);
    fixture.Repository.ApplyTag("1.7.1-beta.1");

    fixture.Checkout(MainBranch);
    fixture.BranchTo("support/1.7");
    fixture.Repository.Merge(fixture.Repository.Branches["hotfix/1.7"], new Signature("a", "b", DateTimeOffset.Now-TimeSpan.FromMinutes(55)), new MergeOptions()
    {
        FastForwardStrategy = FastForwardStrategy.NoFastForward,
    });

    fixture.Repository.ApplyTag("1.7.1");

    fixture.Checkout("hotfix/1.7");
    fixture.Repository.MakeACommit("semver: bug");

    fixture.AssertFullSemver("1.7.2-beta.1", config);
}

that produces the following repository:

* d9e96de 54 minutes ago  (HEAD -> hotfix/1.7)
|   
| *  57c51f7 55 minutes ago  (tag: 1.7.1, support/1.7)
|/|   
* | 79a0af5 56 minutes ago  (tag: 1.7.1-beta.1)
|/  
* 2d1d766 58 minutes ago  (tag: 1.7.0, main)

Expected Behavior

hotfix is set to track-merge-targets = true; hence, I would expect its next version to be 1.7.2-beta.1

Actual Behavior

Running the test produces:

should be 1.7.2-beta.1
but was 1.7.1-beta.2+2

Possible Fix

I suspect the merge target tracking is incomplete, or I am not configuring GitVersion correctly.

Steps to Reproduce

See test above

Context

I am attempting to merge hotfix branches into support branches and have the version of the hotfix branches bumped without requiring a merge back from support into hotfix.

Your Environment

Standard git repository

  • Version Used: 5.3.6
  • Operating System and version (Windows 10):
  • Link to your project: N/A
  • Link to your CI build (if appropriate): N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions