-
Notifications
You must be signed in to change notification settings - Fork 652
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
Hotfix branch is not increasing Patch #2454
Comments
As described in #2441, |
We have a similar issue, but without using For some reason GitVersion completely ignores all hotfix merges. It does find one of 3 existing merges (and 3 times at that), but it does not increment at all:
EDIT: using GitVersion.Tool 5.6.6 and 5.6.7 |
Are you able to reproduce this problem in a test, @senritsu? Look at this this for an idea how to write one: GitVersion/src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs Lines 15 to 48 in 557e96a
|
Yes, I can reproduce it on freshly checked out All existing integration tests in [Test]
public void HotfixMergeIncrementsVersion()
{
using var fixture = new EmptyRepositoryFixture();
// initialize gitflow
const string devBranch = "develop";
fixture.Repository.MakeACommit("setup repo");
fixture.Repository.CreateBranch(devBranch);
Commands.Checkout(fixture.Repository, devBranch);
// make some changes on dev
fixture.Repository.MakeACommit("add stuff");
fixture.Repository.MakeACommit("add more stuff");
// make a release
const string releaseBranch = "release/1.0";
fixture.Repository.CreateBranch(releaseBranch);
Commands.Checkout(fixture.Repository, releaseBranch);
fixture.Repository.MakeACommit("fix some minor thing");
fixture.AssertFullSemver("1.0.0-beta.1+1"); // PASS
Commands.Checkout(fixture.Repository, MainBranch);
fixture.Repository.MergeNoFF(releaseBranch, Generate.SignatureNow());
fixture.AssertFullSemver("1.0.0+0"); // PASS
// make a hotfix
const string hotfixBranch = "hotfix/something-important";
// const string hotfixBranch = "hotfix/1.0.1"; // this also fails in the exact same manner
// const string hotfixBranch = "hotfix-1.0.1"; // this as well
fixture.Repository.CreateBranch(hotfixBranch);
fixture.Repository.MakeACommit("fix the important issue");
// fixture.AssertFullSemver("1.0.1-beta.1+1"); // FAIL, version is 1.0.0+1
Commands.Checkout(fixture.Repository, MainBranch);
fixture.Repository.MergeNoFF(hotfixBranch, Generate.SignatureNow());
fixture.AssertFullSemver("1.0.1+1"); // FAIL, version is 1.0.0+1
} I tried making it as minimal as possible, and judging from the other tests (especially |
With the addition of fixture.ApplyTag("1.0");
fixture.AssertFullSemver("1.0.0"); after merging the release, the whole test passes. This makes things even more strange, since in our production setup we do actually have tagged releases in this manner, and it still fails. Additionally the versioning of |
Interestingly enough, uncommenting the assert on the hotfix branch after committing but before merging fixture.AssertFullSemver("1.0.1-beta.1+1"); // FAIL, version is 1.0.0+1 still fails, because the version at that point is, even with a tagged release, Tangentially related: The error message when using |
This is all very weird. Sorry for not having time to figure out the source of this problem yet. If you're able to submit a PR with the failing test, perhaps you or someone else can pick it up and figure out a fix later. |
details can be found in in GitTools#2454
Using GitVersion.MSBuild 5.7.0, with further investigation we have very confusing results. The setup is a solution with 2 projects, last release A local build results in REDACTED>dotnet build -c Release
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
REDACTED -> REDACTED\bin\Release\netstandard2.0\REDACTED.dll
Successfully created package 'REDACTED\bin\Release\REDACTED.0.5.1.nupkg'.
REDACTED -> REDACTED\bin\Release\netstandard2.0\REDACTED.dll
Successfully created package 'REDACTED\bin\Release\REDACTED.0.5.1.nupkg'.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:05.60 A CI build in GitLab CI run inside the $ dotnet build -c Release
Microsoft (R) Build Engine version 16.11.0+0538acc04 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /builds/REDACTED.csproj (in 4.58 sec).
Restored /builds/REDACTED.csproj (in 4.58 sec).
REDACTED -> /builds/REDACTED/bin/Release/netstandard2.0/REDACTED.dll
Successfully created package '/builds/REDACTED/bin/Release/REDACTED.0.5.0.nupkg'.
REDACTED -> /builds/REDACTED/bin/Release/netstandard2.0/REDACTED.dll
Successfully created package '/builds/REDACTED/bin/Release/REDACTED.0.5.0.nupkg'.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:10.59 At first I thought the local build worked correctly (as mentioned in #2847), but apparently it only increments patch version for exactly one hotfix. |
Version numbers below |
I wanted to saw we are seeing this issue still. It didn't increment Patch in a git flow created hotfix branch. It calculated the same version as if it was running in master (our mainline branch). As a workaround I added a tag to the hotfix branch matching the hotfix name. But, afaict that should be necessary. This happened with an older version (on build server) and I duplicated it with 5.10 on my dev machine. This had worked on other hotfix branches. Not sure what is/was different. |
@PilotBob, what was the name of the hotfix branch? Also, are you using |
hotfix/2022.05.01 We do have a next-version in our .yml file. But it's been there forever. (Well not forever, since we changed from sequential version numbers to date based. So use next-version to go from 11.1.0 to 2021.10.00 version.) After I saw this thread I took it out in the branch, but it didn't seem to make a difference. |
@asbjornu So did a bit more fiddling. It seems that the version calculated in the hotfix branch only increments the patch value is there is a commit in the hotfix branch. So, it my test I did. git flow hotfix start 2022.05.01 In the hotfix branch gitversion calculated 2022.5.0. I added a file, and committed... and then after that it calculated 2022.5.1. So, while not expected, it seems to be working. I just have to remember this for the next time we do a hotfix. :) |
Great. Closing this as a workaround has been found, then. |
@HHobeck, I believe it is, yes. |
Hello,
I am using version 5.5. I want to implement semantic versioning to my GitFlow. I got quite a lot of errors but have managed to work it out - the documentation is really poor.
Still I can't manage to achieve one thing. On bugfixing situation, when I am creating new branch from master, it should have increased patch number - i.e.
master
is 1.0.0, so thehotfix/test
should be 1.0.1 but it is 1.0.0.I can achieve above when I am adding comment '+semver: patch'.
Then, when I want to create 2nd patch, the version is not increasing at all (even with the comment).
How it should work in this scenario?
Here is mine GitVersion file.
Thanks,
Rafal
The text was updated successfully, but these errors were encountered: