GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

[Bug] Wrong semver calculation when making a PR from a hotfix branch to main branch

Open NightFox7 opened this issue 3 years ago • 5 comments

Describe the bug Running the gitversion calculation on a PR pull branch from Hotfix to Main result to a minor increment instead of a patch increment. Here is some diagnostic logs :

 INFO [09/07/22 14:25:07:29] Found possible parent branches: master, origin/hotfix/0.4.1
    WARN [09/07/22 14:25:07:29] Failed to inherit Increment branch configuration, ended up with: master, origin/hotfix/0.4.1
Falling back to develop branch config
  INFO [09/07/22 14:25:07:29] End: Attempting to inherit branch configuration from parent branch (Took: 48.56ms)

I believe the fallback to develop causes the minor increment.

Expected Behavior

A Patch increment

Actual Behavior

A Minor increment

Possible Fix

Steps to Reproduce

See PR https://github.com/GitTools/GitVersion/pull/3186

Your Environment

  • Version Used: 5.10.3
  • Operating System and version (Windows 10, Ubuntu 18.04):

NightFox7 avatar Sep 07 '22 16:09 NightFox7

It may be that the version number in hotfix is not considered. Try setting is-release-branch: true for hotfix in the configuration.

asbjornu avatar Sep 08 '22 11:09 asbjornu

@asbjornu I just tried this but I still get the same result. Just to be clear, the problem is not the version calculation on the hotfix branch, but the calculation on the PR merge branch. The pull-request config inherits the increment mode from the parent branches. Here, the algorithm finds two parent branches (master and origin/hotfix/0.4.1). Therefore, it falls back to the develop branch increment strategy which is minor.

NightFox7 avatar Sep 08 '22 11:09 NightFox7

@NightFox7, please have a look at the discussions in #3101 and #3190. I think they are relevant for your use-case.

asbjornu avatar Sep 12 '22 14:09 asbjornu

I ran the test of my PR on the branch of HHobeck PR #3101 but it is still not working correctly. However, I think micdenny has found the real issue in here https://github.com/GitTools/GitVersion/issues/3020#issuecomment-1245006761

NightFox7 avatar Sep 13 '22 07:09 NightFox7

This will be fixed after merging the PR #3190

NightFox7 avatar Sep 20 '22 08:09 NightFox7

:tada: This issue has been resolved in version 6.0.0 :tada: The release is available on:

Your GitReleaseManager bot :package::rocket:

arturcic avatar Dec 22 '22 15:12 arturcic