You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My master branch has a Tag 6.1.0.
It get correctly picked up by version 5.6.4
INFO [01/28/21 13:53:18:60] Begin: Calculating base versions
INFO [01/28/21 13:53:18:62] Fallback base version: 0.1.0 with commit count source 1f34f7b0477ebdaba3db9de21c9bc4aa1ba432d9
INFO [01/28/21 13:53:18:67] Git tag '6.1.0': 6.1.0 with commit count source ee2c143847ae685ad96dedb7020bf563ac535bea
INFO [01/28/21 13:53:18:72] Found multiple base versions which will produce the same SemVer (6.2.0), taking oldest source for commit counting (Git tag '6.1.0')
INFO [01/28/21 13:53:18:72] Base version used: Git tag '6.1.0': 6.1.0 with commit count source ee2c143847ae685ad96dedb7020bf563ac535bea
INFO [01/28/21 13:53:18:72] End: Calculating base versions (Took: 117.57ms)
but in version 5.6.5 it is not found:
INFO [02/09/21 7:24:04:69] Begin: Calculating base versions
INFO [02/09/21 7:24:04:71] Fallback base version: 0.1.0 with commit count source 1f34f7b0477ebdaba3db9de21c9bc4aa1ba432d9
INFO [02/09/21 7:24:04:80] Found multiple base versions which will produce the same SemVer (0.2.0), taking oldest source for commit counting (Fallback base version)
INFO [02/09/21 7:24:04:80] Base version used: Fallback base version: 0.1.0 with commit count source 1f34f7b0477ebdaba3db9de21c9bc4aa1ba432d9
INFO [02/09/21 7:24:04:80] End: Calculating base versions (Took: 118.04ms)
I don't know if it's related, but I'm also getting strange behavior.
I believe that there is a bug between version 5.6.4 and 5.6.6 that causes an incorrect version to be calculated.
GitVersion 5.6.4 Behavior
INFO [02/09/21 11:17:14:53] Found multiple base versions which will produce the same SemVer (1.5.5), taking oldest source for commit counting (Git tag 'v1.5.4')
GitVersion 5.6.6 Behavior
INFO [02/09/21 11:20:45:54] Found multiple base versions which will produce the same SemVer (1.5.0), taking oldest source for commit counting (Git tag 'v1.4.10')
It's a private project but you can repo it this way:
On Azure Dev Ops create a git repo (branch name master).
Set a tag like 2.0.0
Create a pipeline and use the the gittools tasks to install latest gitversion and then calculate a new version.
@Eneuman are you doing anything "extra" to download additional portions of the git repository? Or how is Azure DevOps performing the checkout of the git repostiory?
Having a complete Azure DevOps yml file for what you are doing would certainly help in figuring out the underlying issue.
A change was made in 5.6.5 to specifically address an issue where the incorrect version number was being asserted on a tagged commit when running on GitHub Actions, so it is possible that this change has had a negative impact when running on Azure DevOps, but in order to figure this out, we would need to complete set of steps to reproduce the problem.
My gut says this has something to do with the change from "master" to "main" (I diffed 5.6.4 with 5.6.6).
We are still using "master" as the name of our main branch.
@Eneuman again to my point, in order to figure this out, we need complete details on how your repository is set up, so that we can start to investigate what is going on.
The ideal here, if possible, would be for you to setup a public repository, in a way that replicates the problem, and that way, we can start to attempt to figure out what is going on.
I ran the gitversion.exe /url https://caresoftab.visualstudio.com/Test/_git/Test /b master /nocache
and I got
I compiled GitVersion from source and run a git bisect on it between versions 5.6.4 and 5.6.5. The bug appears to have been introduced in commit 8b653e9:
8b653e9f75cae9c9918a148de23864feaae736f1 is the first bad commit
commit 8b653e9f75cae9c9918a148de23864feaae736f1
Author: Artur
Date: Sun Jan 31 12:14:26 2021 +0100
changed the default branch from master to main
varmain=this.repositoryStore.FindBranch(Config.MainBranchKey);if(main==null){// for compatibility reason try to find master if main cannot be foundmain=this.repositoryStore.FindBranch(Config.MasterBranchKey);}
solves the issue. Now, I'm not familiar with the codebase at all and have no idea of any side effects, but it keeps all existing tests passing.
@lbras, fantastic debugging! If changing from MainBranchKey to MasterBranchKey fixes the issue, I'm wondering whether this bug may be lurking elsewhere in the codebase as well. Perhaps the simplest fix would be for Config.MainBranchKey to return the value of Config.MasterBranchKey if the former is null? With a fix in place, you're welcome to submit a PR, perhaps in draft state, so we can discuss how to progress it.
We are looking to replace the deprecated GitVersion with the latest GitTools task in Azure Pipelines but we also hit the versioning issue as our repo is using master naming
@asbjornu@arturcic Is it safe to explicitly target 5.6.4 (no risk of depreciation)? Is there any plan to fix this in 5.x? or more likely to be addressed in 6.x?
Already published versions of the GitTools task should continue to work, @superjulius. If they are removed, that's beyond our control and up to Microsoft, if anything. There is no plan to fix this beyond us accepting a pull request that fixes it. As none of the maintainers seem to have this issue, we have no incentive to work on it, unfortunately.
I've submitted #3037 based on @Ibras' suggestions. If you can think of a way to reproduce the issue in a test, I'd be very grateful. If not, I think the fix is worth merging even without a regression test.
Activity
luis-fss commentedon Feb 9, 2021
I don't know if it's related, but I'm also getting strange behavior.
I believe that there is a bug between version 5.6.4 and 5.6.6 that causes an incorrect version to be calculated.
GitVersion 5.6.4 Behavior
INFO [02/09/21 11:17:14:53] Found multiple base versions which will produce the same SemVer (1.5.5), taking oldest source for commit counting (Git tag 'v1.5.4')GitVersion 5.6.6 Behavior
INFO [02/09/21 11:20:45:54] Found multiple base versions which will produce the same SemVer (1.5.0), taking oldest source for commit counting (Git tag 'v1.4.10')GitVersion.yml.txt
GitVersion-5.6.5.diagnostic.txt
GitVersion-5.6.6.diagnostic.txt
GitVersion-5.6.4.diagnostic.txt
arturcic commentedon Feb 9, 2021
@gep13 might be related to your fix
gep13 commentedon Feb 10, 2021
@Eneuman do you have a link to the project where this is occuring?
Eneuman commentedon Feb 10, 2021
It's a private project but you can repo it this way:
On Azure Dev Ops create a git repo (branch name master).
Set a tag like 2.0.0
Create a pipeline and use the the gittools tasks to install latest gitversion and then calculate a new version.
Use default settings and run a build.
arturcic commentedon Feb 10, 2021
Would be great to have a fixture test that reproduce the issue
Eneuman commentedon Feb 10, 2021
I can also verify that going back to version 5.6.4 solves the problem so something have definitely changed.
gep13 commentedon Feb 10, 2021
@Eneuman are you doing anything "extra" to download additional portions of the git repository? Or how is Azure DevOps performing the checkout of the git repostiory?
Having a complete Azure DevOps yml file for what you are doing would certainly help in figuring out the underlying issue.
A change was made in 5.6.5 to specifically address an issue where the incorrect version number was being asserted on a tagged commit when running on GitHub Actions, so it is possible that this change has had a negative impact when running on Azure DevOps, but in order to figure this out, we would need to complete set of steps to reproduce the problem.
Eneuman commentedon Feb 10, 2021
@gep13 The yml file is very basic:
and the config file:
My gut says this has something to do with the change from "master" to "main" (I diffed 5.6.4 with 5.6.6).
We are still using "master" as the name of our main branch.
gep13 commentedon Feb 10, 2021
@Eneuman again to my point, in order to figure this out, we need complete details on how your repository is set up, so that we can start to investigate what is going on.
The ideal here, if possible, would be for you to setup a public repository, in a way that replicates the problem, and that way, we can start to attempt to figure out what is going on.
Is this something that you can help with?
Eneuman commentedon Feb 10, 2021
@gep13 sure I can fix that.
I have setup a public repo at https://caresoftab.visualstudio.com/Test/_git/Test
The repo has 3 tags:

git tagreports this:3.0.0
3.1.0
4.0.0
gitversion.exe /url https://caresoftab.visualstudio.com/Test/_git/Test /b master /nocache
A quick analysis showed me that LibGit2Sharp tagcollection only contains the 3.0.0 tag.
arturcic commentedon Feb 10, 2021
thank you for the sample, we'll have a look
arturcic commentedon Feb 10, 2021
I ran the
gitversion.exe /url https://caresoftab.visualstudio.com/Test/_git/Test /b master /nocacheand I got
arturcic commentedon Feb 10, 2021
I used version 5.6.6, locally
Eneuman commentedon Feb 10, 2021
I added a new file and another tag 5.0.0
Can you try again now?
26 remaining items
lbras commentedon Oct 1, 2021
I compiled GitVersion from source and run a git bisect on it between versions 5.6.4 and 5.6.5. The bug appears to have been introduced in commit 8b653e9:
lbras commentedon Oct 1, 2021
Took a quick look at the code and found the following. Updating line 53 from TrackReleaseBranchesVersionStrategy.cs (MainTagsVersions method) from
to
solves the issue. Now, I'm not familiar with the codebase at all and have no idea of any side effects, but it keeps all existing tests passing.
Any advice on this? @asbjornu @arturcic
asbjornu commentedon Oct 1, 2021
@lbras, fantastic debugging! If changing from
MainBranchKeytoMasterBranchKeyfixes the issue, I'm wondering whether this bug may be lurking elsewhere in the codebase as well. Perhaps the simplest fix would be forConfig.MainBranchKeyto return the value ofConfig.MasterBranchKeyif the former isnull? With a fix in place, you're welcome to submit a PR, perhaps in draft state, so we can discuss how to progress it.superjulius commentedon Mar 1, 2022
We are looking to replace the deprecated GitVersion with the latest GitTools task in Azure Pipelines but we also hit the versioning issue as our repo is using master naming
@asbjornu @arturcic Is it safe to explicitly target 5.6.4 (no risk of depreciation)? Is there any plan to fix this in 5.x? or more likely to be addressed in 6.x?
asbjornu commentedon Mar 1, 2022
Already published versions of the GitTools task should continue to work, @superjulius. If they are removed, that's beyond our control and up to Microsoft, if anything. There is no plan to fix this beyond us accepting a pull request that fixes it. As none of the maintainers seem to have this issue, we have no incentive to work on it, unfortunately.
Fall back to `master` if `main` is missing
asbjornu commentedon Mar 8, 2022
I've submitted #3037 based on @Ibras' suggestions. If you can think of a way to reproduce the issue in a test, I'd be very grateful. If not, I think the fix is worth merging even without a regression test.
Fall back to `master` if `main` is missing
Fall back to `master` if `main` is missing
Merge pull request #3037 from asbjornu/feature/gh-2590
github-actions commentedon Apr 14, 2022
🎉 This issue has been resolved in version 5.10.0 🎉
The release is available on:
Your GitReleaseManager bot 📦🚀