Skip to content

[Bug] SemVer of a feature branch started from a release branch gets decremented #3151

@ni-jsuchocki

Description

@ni-jsuchocki

Describe the bug

Hello! We are using GitVersion with the GitFlow branching scheme. I'd expect that the feature branch started from a release branch has the same SemVer as the parent release branch.

Expected Behavior

SemVer of a commit on a feature branch is the same as the SemVer of a parent release branch.

Actual Behavior

SemVer gets decremented to the previous release version.

Steps to Reproduce

[Test]
public void ShouldPickUpReleaseVersionAfterCreatedFromRelease()
{
    using var fixture = new EmptyRepositoryFixture();

    // Create develop and a release branch
    fixture.MakeATaggedCommit("1.0.0");
    fixture.MakeACommit();
    fixture.BranchTo("develop");
    fixture.BranchTo("release/1.1.0");
    fixture.MakeACommit();
    fixture.AssertFullSemver("1.1.0-beta.1+1");


    // Create a feature branch from the release/1.1.0 branch
    fixture.BranchTo("feature/test");
    fixture.MakeACommit();
    fixture.AssertFullSemver("1.1.0-test.1+1");  // this fails (returns 1.0.0-test.1+3)
}

Context

I know this can be fixed by setting tracks-release-branches: true for the release branch type, but this has other consequences as well - for example if a release/2.0.0 branch is started in the same repo, the SemVer of a build from a feature branch will be 2.0.0 even if its parent branch is release/1.1.0.

Also looking at the docs for track-release-branches - Indicates this branch config represents develop in GitFlow. - I am wary to change it for release branches.

It looks as it should be the default behaviour for me, but am I missing some other configuration options that would change this?

Your Environment

  • Version Used: The unit test above was tested with main at 5.10.4-beta.1+41.Branch.main.Sha.68604754376c7df1d7a378a3a29fb92d55dd3013, same behavior is observed in our CI where 5.8.2 is installed
  • Operating System and version: Mac11 locally, Windows 10 in CI

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions