-
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
Base version calculation failed since 5.6.5 #2801
Comments
Sub |
I don't see why it would behave differently but if there are no consistent behavior with any version below 1.0.0, I would recommend disabling the ability for developers to use anything lower than 1.0.0 and have it documented. |
I agree it's unfortunate and we do consider it a bug, it's just not something we maintainers have an incentive to fix since we rarely add tags lower than |
@asbjornu I'm seeing some behaviour that suggests there may be an issue with calculating base versions since 5.6.4 - not sure if it's exactly the same as the issue reported here, but feels at least related. Running GitVersion against a release branch (1.1.0) in my repo returns a different base version between 5.6.3 and 5.6.4. In 5.6.4, this results in a CommitsSinceVersionSource value of 0. It looks like the difference is that, since 5.6.4, the remote of the same branch is being returned as a source branch. 5.6.3 output:
5.6.4 output:
Is this expected behaviour? Or is there a possible issue with my repo/config that is causing this? FYI, GitVersion.yml is:
Thanks. |
Is the output from 5.7.0 the same as from 5.6.4? |
@asbjornu I did wonder whether it was an issue that had been fixed in 5.7.0, but yes, it's still the same. Output below:
|
The important difference seems to be these two differing lines:
So I can only assume that something has changed between 5.6.3 and 5.6.4 regarding ordering of branches that makes it chose However, as the log indicates, "incorrect commit counting" may occur due to GitVersion finding several source branches, so I would say your repository is in undefined territory and that unexpected change of behaviour is to be expected. I would investigate why multiple source branches are found and fix that problem, if I were you. |
What I thought was more interesting was that This issue seems to suggest that the same issue had existed previously. I understand that multiple source branches can cause issues with commit counting but, without this branch being returned as a source branch - which the above issue suggests was/is incorrect - the issue wouldn't exist. |
I've built the source locally and had a look. Looks like the issue is that the way that branches are being compared has changed. In the 5.6.3 version of In 5.6.4, this call to |
Updating line 324 of RepositoryStore.cs from:
To:
Looks to be more in keeping with how the functionality worked prior to 5.6.4, resolves my issue and also keeps all existing tests passing. Happy to raise a PR if you think this seems like a reasonable change? |
Sounds great! A PR would be welcome. 🙏🏼 |
@asbjornu PR raised. It's the first OS PR I've raised so please do let me know if I've not done anything properly. Cheers |
Ohai - I just found out that upgrading from 5.0 beta to 5.8.1 yielded something that looks like this. Our tags are no longer used, and Gitversion goes back to a (very) old release branch when we used that. I tried gitversion I couldn't identify if the merged PR was in |
The code change I made is present in the 5.8.1 tag: https://github.com/GitTools/GitVersion/blob/5.8.1/src/GitVersion.Core/Core/RepositoryStore.cs This change definitely resolved my issue... may be that your issue has a slightly different route cause to the issue that my change addressed? It should also be noted that the issue I addressed may not be the same as the one in the original issue raised here (I did note that it may not be the same, but felt at least related). Therefore if your behaviour is more in line with the issue originally raised, then it may also be that my change hasn't resolved your issue |
I've tried to create a reproduce that doesn't require disclosing our entire history, but after a few hours I haven't been able to.. I boil down the history and replace messages, but I can't get both the 5.6.4 and later versions of gitversion to give the output I currently see in our original repository. If needed, I can give it another shot, and maybe send a bundle to @asbjornu or another dev for testing. As a minimum, I can remove the data, the authors, and maybe most messages (if I can figure out the exact messages needed for base calculation).. |
@LordMike, thanks for spending so much time trying to reproduce this. That is highly appreciated! The best for future proofing against this bug would be to have a |
I think I know more about why I had such issues reproducing.. I've just found that apparently the cache gitversion makes, is giving me issues?.. So making a version with one gitversion, makes a different gitversion produce the same results even when it shouldn't.. I'm running with ... This helped a lot. I have the following. In this repository, we got
I've created a bundle that you can clone from ( Running the two dotnet-install / dotnet-gitversion commands should produce the |
If we can figure out which commits are needed, I can try making a unit test with the necessary commits/tags/branches to reproduce this. Some other weird stuff I noticed. I originally removed more tags than I leave in this bundle, but doing so pushed the gitversion further back to Gitversion |
GitVersion should choose the highest version source it finds and shouldn't care about when they were added. If that's something that changed after version |
I might be - will see if I can fit it in.. :) |
@asbjornu I tried So I ran the The following commit is marked as "bad": 8b653e9
It sounds like it could be obvious - we use main:
mode: ContinuousDeployment
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^master$|^main$
source-branches:
- develop
- release
tracks-release-branches: false
is-release-branch: false
is-mainline: true
pre-release-weight: 55000 While in 5.6.4, I get the following for master:
mode: ContinuousDeployment
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^master$|^main$
source-branches:
- develop
- release
tracks-release-branches: false
is-release-branch: false
is-mainline: true
pre-release-weight: 55000 Maybe some code has a hard dependency on the name |
So, I tried copying the config of the working
Which is weird, because my config specifically configures ... but it should still work imo, as the name of the configuration shouldn't matter - the regex that identifies the branch names is the same. Soo.. I'm at a loss.. :) |
I wonder if this is related to #2590. 🤔 |
Sounds identical. :O |
I should think so, @LordMike! Can you please take it for a spin and report back your findings? 🙏🏼 |
I assumed it would work - so we’ve been running 5.10.1 for a few days, haven’t noticed anything weird yet. Will turn back with a vengeance if I do :)
Go ahead and close this. Thanks for the help :)
Mike.
…________________________________
From: Asbjørn Ulsberg ***@***.***>
Sent: Friday, May 13, 2022 12:43:28 AM
To: GitTools/GitVersion ***@***.***>
Cc: Michael Bisbjerg ***@***.***>; Mention ***@***.***>
Subject: Re: [GitTools/GitVersion] Base version calculation failed since 5.6.5 (#2801)
I should think so, @LordMike<https://github.com/LordMike>! Can you please take it for a spin and report back your findings? 🙏🏼
—
Reply to this email directly, view it on GitHub<#2801 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAH2YJ2DTH5S7THX7QV5MF3VJWCRBANCNFSM5B24I2AQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Resolved in #3037. |
There seems to be a bug that started in version 5.6.5 where it is does not utilize the existing commit tags information to determine the version. I was tested many versions from 5.6.4 and lower and it works while any version from 5.6.5 to 5.6.11 does not. I do not have a sample test repo that replicates this behavior but it is a relatively new repository with just a single version tag "0.1.0".
Log from 5.6.4:
Log from 5.6.5:
GitVersion configuration:
The below configuration is for 5.6.5; and slightly different on 5.6.4, which used the branch "master" instead of "main".
The text was updated successfully, but these errors were encountered: