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] VersionInBranchNameVersionStrategy only considers the release branch #2693

Closed
Tracked by #3445
ruhullahshah opened this issue May 17, 2021 · 3 comments · Fixed by #3455
Closed
Tracked by #3445

[Bug] VersionInBranchNameVersionStrategy only considers the release branch #2693

ruhullahshah opened this issue May 17, 2021 · 3 comments · Fixed by #3455
Labels
Milestone

Comments

@ruhullahshah
Copy link
Contributor

ruhullahshah commented May 17, 2021

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

@asbjornu
Copy link
Member

Make strategy branch agnostic.

As long as we don't have any regressions, that sounds like a fine improvement to me. 👍🏼 Do you have a solution in mind that you can submit a PR for? 🙏🏼

@ruhullahshah
Copy link
Contributor Author

ruhullahshah commented May 18, 2021

@asbjornu Yes, I do have a solution and as a first step, I have added a failing unit test that better illustrates this problem in PR #2696.

@HHobeck HHobeck added this to the 6.x milestone Mar 21, 2023
@arturcic arturcic modified the milestones: 6.x, 6.0.0-beta.2 Apr 6, 2023
@arturcic
Copy link
Member

arturcic commented Apr 6, 2023

🎉 This issue has been resolved in version 6.0.0-beta.2 🎉
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

Successfully merging a pull request may close this issue.

4 participants