Skip to content

[Bug] Hotfix branch name not taken as version source #2336

@dramdrung

Description

@dramdrung

Describe the bug
In documentation: https://gitversion.net/docs/more-info/version-increments, at point Branch name it's mentioned that the version in Hotfix branch name should be taken as version source.
It's not working.
Was behavior changed and not documented?

Expected Behavior

In case there is version in hotfix branch e.g. hotfix/4.21.1, the version 4.21.1 should be taken as version source.

Actual Behavior

The version in branch name is not taken into consideration when calculating version.
Version calculated is lower than expected.

Possible Fix

From what I can see in VersionInBranchNameVersionStrategy class, the version is taken only from Release branches based on is-release-branch flag in GitVersion config.
It could be extended to check if a branch is hotfix with Regex, then try to get version from branch name.

Steps to Reproduce

Submitted Test Case scenario.
#2337

Context

When creating hotfix branch for a bug in a release, I expect to build the branch with same version as release.
As I have read documentation, I could achieve it with including version in a branch name.
Except it doesn't work.
It calculates version lower than the Release version, cause it doesn't take version from branch name.

Your Environment

  • Version Used: 5.3.6
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows 10
  • Link to your project:
  • Link to your CI build (if appropriate):

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