GitVersion
GitVersion copied to clipboard
[Bug] Wrong semver calculation when making a PR from a hotfix branch to main branch
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):
It may be that the version number in hotfix is not considered. Try setting is-release-branch: true for hotfix in the configuration.
@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, please have a look at the discussions in #3101 and #3190. I think they are relevant for your use-case.
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
This will be fixed after merging the PR #3190
:tada: This issue has been resolved in version 6.0.0 :tada: The release is available on:
Your GitReleaseManager bot :package::rocket: