Skip to content

[Bug] VersionInBranchNameVersionStrategy only considers the release branch #2693

@ruhullahshah

Description

@ruhullahshah

Description

In order to calculate the next version, GitVersion evaluates the version numbers produced by various candidates and selects the one that yields the highest version number on a give branch. VersionInBranchNameVersionStrategy is one of the candidates and from the name of it, should only look at the current branch. For instance, hotfix/17.1.0. However, this strategy seems to be biased and only considers release branches. This approach probably violates the single responsibility principle and can be a source of bugs.

Additionally, another strategy uses it and the version detection in the branch name could probably be parameterized.

Expected Behavior

The strategy should consider the version in the current branch, e.g. hotfix/17.1.0

Actual Behavior

The version in the hotfix branch name has no chance to make it to the list of possible candidates.

Possible Fix

Make strategy branch agnostic.

Context

1.We created a hotfix branch (hotfix/1.0.1) from the tag v1.0.0
2. However, the calculated version number was still 1.0.0-something because we had set prevent-increment-of-merged-branch-version to true.
3. In this situation, we would have expected the version number from the hotfix branch name to make it to the list of candidates as well.

Workaround

Set the prevent-increment-of-merged-branch-version to false

Environment

OS: Windows
GitVersion version: Latest

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