Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dramdrung opened this issue Jun 23, 2020 · 10 comments
Closed

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

dramdrung opened this issue Jun 23, 2020 · 10 comments
Labels
Milestone

Comments

@dramdrung
Copy link

dramdrung commented Jun 23, 2020

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):
@asbjornu
Copy link
Member

What happens if you configure hotfix branches with is-release-branch: true?

@dramdrung
Copy link
Author

@asbjornu
If the is-release-branch: true is set for Hotfix branches, it works.
It's a solution, but I wonder if there are any other effects of setting Hotfix branches as releases?
Looking at the documentation it seemed like that behavior would be out of the box, is it intentional to work only after setting the flag?

@asbjornu
Copy link
Member

asbjornu commented Jun 23, 2020

I assume this behaviour was changed in #1541, where before, numbers in branch names were accidentally interpreted as version numbers, causing trouble all over the place. Hotfix branches should probably be considered release branches by default, though. Would you be up for submitting a PR with this default configuration change?

@dramdrung
Copy link
Author

I can take a look and try to make the change. Probably by the end of the week, when I have free time.

@dramdrung
Copy link
Author

@asbjornu I made the change to default configuration and adjusted/added the test scenarios to the it.
PR can be seen at #2346.
It seems that with this change handling of merge messages of Hotfix branches will be changed as well.
There were several test scenarios where it was expected that Hotfix branch merges should not be taken into consideration in version calculation, what do you think about it?

@asbjornu
Copy link
Member

asbjornu commented Jul 2, 2020

Great, I'll take a look at the PR.

@pi3k14
Copy link
Contributor

pi3k14 commented Nov 4, 2020

This issue is related to #2442 - merging release/hotfix branch to master.

@asbjornu
Copy link
Member

asbjornu commented Mar 8, 2022

Would it be possible to submit a PR with a test that demonstrates this problem, if it still exists?

@HHobeck HHobeck added this to the 6.x milestone Feb 21, 2023
@HHobeck
Copy link
Contributor

HHobeck commented Feb 28, 2023

Has been resolved with PR #2336 without the need of specifing IsRelease to true for Hotfix branches.

@HHobeck HHobeck closed this as completed Feb 28, 2023
@arturcic arturcic modified the milestones: 6.x, 6.0.0-beta.1 Mar 2, 2023
@arturcic
Copy link
Member

arturcic commented Mar 2, 2023

🎉 This issue has been resolved in version 6.0.0-beta.1 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants