-
Notifications
You must be signed in to change notification settings - Fork 656
Description
Prerequisites
- I have written a descriptive issue title
- I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.Tool
GitVersion version
Operating system
Windows
What are you seeing?
Hi. I ran into a problem when updating gitversion from 5.8.2 to 6.0.4 on our build server. The problem is that version for "old" branches (v-10, v-11, v-12) suddenly become to evaluate from tag inside default (master) branch. For example, master has the latest tag 20.1.5 and branch v-11 has its latest tag 11.7.0 so making a new commit into v-11 I expect to get version 11.7.1. So it was before upgrading to gitversion 6.0.4. After upgrade I have version 20.1.6.
I spent some time on reading release notes/breaking changes with no luck. Then I started to check commit by commit in version history to localize the problem and have come to #3441.
Consider taking https://github.com/destructurama/attributed repo as an example:
- Clone it
- Make branch
test
from tag 4.1.0 - Type 1 symbol in readme to just make some commit.
- Commit.
Now I expect 4.1.1 output from gitversion.
My results (with stripped out time marks and execution time to make diff cleaner):
- b0f6c77 commit before Consider pre-release tags only when they matching with the label name on branch #3441:
INFO [07/29/25] Dumping commit graph:
INFO [07/29/25] * 24332eb 19 hours ago (HEAD -> test)
| * 1c41b74 3 weeks ago (origin/dependabot/nuget/src/Benchmarks/multi-da0ccf5965)
| * 987ee31 9 weeks ago (origin/master, master)
| * 53a8fe0 9 weeks ago
| * 943c9e8 3 months ago
| * 7459b46 3 months ago
| * 6afbc60 5 months ago
| * c76d262 5 months ago
| | * 768ba37 9 weeks ago (origin/gh-pages)
| | * 5c62d8a 9 weeks ago
| | * dbadca1 3 months ago
| | * 5720d6b 3 months ago
| | * e12a85b 5 months ago
| | * 08db8e9 5 months ago
| | * 05e3c6e 5 months ago
| | * b3772f9 5 months ago
| | * 151cf01 5 months ago
| | * aaf1ecd 5 months ago
| | * bc60eac 5 months ago
| | * 34f871e 6 months ago
| | * 4a3f578 6 months ago
| | * c6122c3 6 months ago
| | * d4f2a24 7 months ago
| | * ef388ad 7 months ago
| | * 7824a8d 7 months ago
| | * d81bc5b 7 months ago
| | * ae24a68 7 months ago
| | * 1368705 7 months ago
| | * 2cf054a 7 months ago
| | * bf3d396 7 months ago
| | * 22461ec 7 months ago
| | * dd54481 7 months ago
| | * 8c99e14 7 months ago
| | * 76668b0 8 months ago
| | * 732f8d4 8 months ago
| | * 56e76b7 8 months ago
| | * af32124 8 months ago
| | * 271a6d5 8 months ago
| | * c210d8e 8 months ago
| | * 2b9f19f 8 months ago
| | * 3d85341 8 months ago
| | * 0bc28f2 8 months ago
| | * e9acbe7 8 months ago
| | * 66198e9 8 months ago
| | * bc53287 8 months ago
| | * 286a589 8 months ago
| | * a59379c 8 months ago
| | * cb171cd 8 months ago
| | * ada54ef 8 months ago
| | * 0603a1e 8 months ago
| | * 9106eae 8 months ago
| | * 29ccb17 8 months ago
| | * 0885c1d 8 months ago
| | * 3198cc9 8 months ago
| | * 60ea92a 1 year, 4 months ago
| | * d91e71d 1 year, 5 months ago
| | * e38e415 1 year, 5 months ago
| | * 7f8b5b6 1 year, 5 months ago
| | * 04bae51 1 year, 5 months ago
| | * 20fe078 1 year, 5 months ago
| | * 307823d 1 year, 5 months ago
| | * 6974e8d 1 year, 5 months ago
| | * b54a47a 1 year, 5 months ago
| | * 8907b9a 1 year, 6 months ago
| | * de159c2 1 year, 6 months ago
| | * 13d0425 1 year, 6 months ago
| | * ee284c4 1 year, 6 months ago
| | * d8b644a 1 year, 6 months ago
| | * 954cd02 1 year, 6 months ago
| | * 675c60e 1 year, 6 months ago
| | * 9adc69e 1 year, 6 months ago
| | * ad8e83c 1 year, 6 months ago
| | * be31f69 1 year, 6 months ago
| | * 8267d10 1 year, 6 months ago
| | * f0f3b76 1 year, 6 months ago
| | * 956a9d7 1 year, 6 months ago
| | * bd1be98 1 year, 6 months ago
| | * 0de7a0f 1 year, 6 months ago
| | * f3839d0 1 year, 6 months ago
| | * ee5d2ff 1 year, 6 months ago
| | * 492e6fc 1 year, 6 months ago
| | * ac8c222 1 year, 6 months ago
| | | * 0300085 5 months ago (origin/proj)
| | | |\
| | |_|/
| |/| |
| * | | aea6988 5 months ago
| * | | 56dfb37 5 months ago
| * | | e7b250e 5 months ago
| * | | 8ad833e 5 months ago
| * | | bbef6fc 5 months ago
| | | * 1fb63db 7 months ago (proj)
| | | |\
| | | | * da13b22 7 months ago
| | | * | 1bfd891 7 months ago
| | | |/
| | | * 43fe222 7 months ago
| | | | * f258114 5 months ago (Corniel/corniel/dotnet-sdk)
| | | | * 1b89754 5 months ago
| | | | * 5ebbced 5 months ago
| | | | * 43d0ffa 5 months ago
| | | | * 31b0daf 5 months ago
| | |_|/
| |/| |
| * | | 7c10927 6 months ago
| * | | e6c62d7 6 months ago
| * | | 40a992e 6 months ago
INFO [07/29/25] Working directory: C:\_GITHUB_\attributed
INFO [07/29/25] Project root is: C:\_GITHUB_\attributed\
INFO [07/29/25] DotGit directory is: C:\_GITHUB_\attributed\.git
INFO [07/29/25] Branch from build environment:
INFO [07/29/25] Using latest commit on specified branch
INFO [07/29/25] Running against branch: test (24332eb aaa)
INFO [07/29/25] Begin: Calculating the base versions
INFO [07/29/25] Begin: Finding branches source of 'test'
INFO [07/29/25] Begin: Finding merge base between 'test' and 'master'.
INFO [07/29/25] Found merge base of 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] Merge base of test' and 'master is 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] End: Finding merge base between 'test' and 'master'.
INFO [07/29/25] Begin: Finding merge base between 'test' and 'origin/master'.
INFO [07/29/25] Found merge base of 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] Merge base of test' and 'origin/master is 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] End: Finding merge base between 'test' and 'origin/master'.
INFO [07/29/25] End: Finding branches source of 'test'
INFO [07/29/25] Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] Found multiple base versions which will produce the same SemVer (4.1.1), taking oldest source for commit counting (Git tag '4.1.0')
INFO [07/29/25] Base version used: Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] End: Calculating the base versions
INFO [07/29/25] Using branch name to calculate version tag
INFO [07/29/25] 1 commits found between 0ada1b1 Support string enumerables in LogReplacedAttribute (#127) and 24332eb aaa
INFO [07/29/25] Begin: Getting version tags from branch 'refs/heads/test'.
INFO [07/29/25] End: Getting version tags from branch 'refs/heads/test'.
Executing GenerateSetVersionMessage for 'LocalBuild'.
Executing GenerateBuildLogOutput for 'LocalBuild'.
{
"Major": 4,
"Minor": 1,
"Patch": 1,
"PreReleaseTag": "test.1",
"PreReleaseTagWithDash": "-test.1",
"PreReleaseLabel": "test",
"PreReleaseLabelWithDash": "-test",
"PreReleaseNumber": 1,
"WeightedPreReleaseNumber": 55001,
"BuildMetaData": 1,
"FullBuildMetaData": "1.Branch.test.Sha.24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"MajorMinorPatch": "4.1.1",
"SemVer": "4.1.1-test.1",
"AssemblySemVer": "4.1.1.0",
"AssemblySemFileVer": "4.1.1.0",
"FullSemVer": "4.1.1-test.1+1",
"InformationalVersion": "4.1.1-test.1+1.Branch.test.Sha.24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"BranchName": "test",
"EscapedBranchName": "test",
"Sha": "24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"ShortSha": "24332eb",
"VersionSourceSha": "0ada1b11d105abeda3746b1a5eefba65a497de99",
"CommitsSinceVersionSource": 1,
"CommitDate": "2025-07-28",
"UncommittedChanges": 0
}
INFO [07/29/25] Done writing
OK, 4.1.1
- bb071c0 commit after merging Consider pre-release tags only when they matching with the label name on branch #3441:
INFO [07/29/25] Dumping commit graph:
INFO [07/29/25] * 24332eb 19 hours ago (HEAD -> test)
| * 1c41b74 3 weeks ago (origin/dependabot/nuget/src/Benchmarks/multi-da0ccf5965)
| * 987ee31 9 weeks ago (origin/master, master)
| * 53a8fe0 9 weeks ago
| * 943c9e8 3 months ago
| * 7459b46 3 months ago
| * 6afbc60 5 months ago
| * c76d262 5 months ago
| | * 768ba37 9 weeks ago (origin/gh-pages)
| | * 5c62d8a 9 weeks ago
| | * dbadca1 3 months ago
| | * 5720d6b 3 months ago
| | * e12a85b 5 months ago
| | * 08db8e9 5 months ago
| | * 05e3c6e 5 months ago
| | * b3772f9 5 months ago
| | * 151cf01 5 months ago
| | * aaf1ecd 5 months ago
| | * bc60eac 5 months ago
| | * 34f871e 6 months ago
| | * 4a3f578 6 months ago
| | * c6122c3 6 months ago
| | * d4f2a24 7 months ago
| | * ef388ad 7 months ago
| | * 7824a8d 7 months ago
| | * d81bc5b 7 months ago
| | * ae24a68 7 months ago
| | * 1368705 7 months ago
| | * 2cf054a 7 months ago
| | * bf3d396 7 months ago
| | * 22461ec 7 months ago
| | * dd54481 7 months ago
| | * 8c99e14 7 months ago
| | * 76668b0 8 months ago
| | * 732f8d4 8 months ago
| | * 56e76b7 8 months ago
| | * af32124 8 months ago
| | * 271a6d5 8 months ago
| | * c210d8e 8 months ago
| | * 2b9f19f 8 months ago
| | * 3d85341 8 months ago
| | * 0bc28f2 8 months ago
| | * e9acbe7 8 months ago
| | * 66198e9 8 months ago
| | * bc53287 8 months ago
| | * 286a589 8 months ago
| | * a59379c 8 months ago
| | * cb171cd 8 months ago
| | * ada54ef 8 months ago
| | * 0603a1e 8 months ago
| | * 9106eae 8 months ago
| | * 29ccb17 8 months ago
| | * 0885c1d 8 months ago
| | * 3198cc9 8 months ago
| | * 60ea92a 1 year, 4 months ago
| | * d91e71d 1 year, 5 months ago
| | * e38e415 1 year, 5 months ago
| | * 7f8b5b6 1 year, 5 months ago
| | * 04bae51 1 year, 5 months ago
| | * 20fe078 1 year, 5 months ago
| | * 307823d 1 year, 5 months ago
| | * 6974e8d 1 year, 5 months ago
| | * b54a47a 1 year, 5 months ago
| | * 8907b9a 1 year, 6 months ago
| | * de159c2 1 year, 6 months ago
| | * 13d0425 1 year, 6 months ago
| | * ee284c4 1 year, 6 months ago
| | * d8b644a 1 year, 6 months ago
| | * 954cd02 1 year, 6 months ago
| | * 675c60e 1 year, 6 months ago
| | * 9adc69e 1 year, 6 months ago
| | * ad8e83c 1 year, 6 months ago
| | * be31f69 1 year, 6 months ago
| | * 8267d10 1 year, 6 months ago
| | * f0f3b76 1 year, 6 months ago
| | * 956a9d7 1 year, 6 months ago
| | * bd1be98 1 year, 6 months ago
| | * 0de7a0f 1 year, 6 months ago
| | * f3839d0 1 year, 6 months ago
| | * ee5d2ff 1 year, 6 months ago
| | * 492e6fc 1 year, 6 months ago
| | * ac8c222 1 year, 6 months ago
| | | * 0300085 5 months ago (origin/proj)
| | | |\
| | |_|/
| |/| |
| * | | aea6988 5 months ago
| * | | 56dfb37 5 months ago
| * | | e7b250e 5 months ago
| * | | 8ad833e 5 months ago
| * | | bbef6fc 5 months ago
| | | * 1fb63db 7 months ago (proj)
| | | |\
| | | | * da13b22 7 months ago
| | | * | 1bfd891 7 months ago
| | | |/
| | | * 43fe222 7 months ago
| | | | * f258114 5 months ago (Corniel/corniel/dotnet-sdk)
| | | | * 1b89754 5 months ago
| | | | * 5ebbced 5 months ago
| | | | * 43d0ffa 5 months ago
| | | | * 31b0daf 5 months ago
| | |_|/
| |/| |
| * | | 7c10927 6 months ago
| * | | e6c62d7 6 months ago
| * | | 40a992e 6 months ago
INFO [07/29/25] Working directory: C:\_GITHUB_\attributed
INFO [07/29/25] Project root is: C:\_GITHUB_\attributed\
INFO [07/29/25] DotGit directory is: C:\_GITHUB_\attributed\.git
INFO [07/29/25] Branch from build environment:
INFO [07/29/25] Using latest commit on specified branch
INFO [07/29/25] Running against branch: test (24332eb aaa)
INFO [07/29/25] Begin: Calculating the base versions
INFO [07/29/25] Begin: Finding branches source of 'test'
INFO [07/29/25] Begin: Finding merge base between 'test' and 'master'.
INFO [07/29/25] Found merge base of 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] Merge base of test' and 'master is 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] End: Finding merge base between 'test' and 'master'.
INFO [07/29/25] Begin: Finding merge base between 'test' and 'origin/master'.
INFO [07/29/25] Found merge base of 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] Merge base of test' and 'origin/master is 0ada1b1 Support string enumerables in LogReplacedAttribute (#127)
INFO [07/29/25] End: Finding merge base between 'test' and 'origin/master'.
INFO [07/29/25] End: Finding branches source of 'test'
INFO [07/29/25] Begin: Getting tagged semantic versions. LabelPrefix: [vV]? and Format: Strict
INFO [07/29/25] End: Getting tagged semantic versions. LabelPrefix: [vV]? and Format: Strict
INFO [07/29/25] Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] Using current branch name to calculate version tag
INFO [07/29/25] Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] Using current branch name to calculate version tag
INFO [07/29/25] Found multiple base versions which will produce the same SemVer (4.1.1-test.1), taking oldest source for commit counting (Git tag '4.1.0')
INFO [07/29/25] Base version used: Git tag '4.1.0': 4.1.0 with commit count source 0ada1b11d105abeda3746b1a5eefba65a497de99
INFO [07/29/25] End: Calculating the base versions
INFO [07/29/25] 1 commits found between 0ada1b1 Support string enumerables in LogReplacedAttribute (#127) and 24332eb aaa
INFO [07/29/25] Begin: Getting tagged semantic versions from 'refs/remotes/origin/master'. LabelPrefix: [vV]? and Format: Strict
INFO [07/29/25] End: Getting tagged semantic versions from 'refs/remotes/origin/master'. LabelPrefix: [vV]? and Format: Strict
Executing GenerateSetVersionMessage for 'LocalBuild'.
Executing GenerateBuildLogOutput for 'LocalBuild'.
{
"Major": 5,
"Minor": 1,
"Patch": 0,
"PreReleaseTag": "test.1",
"PreReleaseTagWithDash": "-test.1",
"PreReleaseLabel": "test",
"PreReleaseLabelWithDash": "-test",
"PreReleaseNumber": 1,
"WeightedPreReleaseNumber": 55001,
"BuildMetaData": 1,
"FullBuildMetaData": "1.Branch.test.Sha.24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"MajorMinorPatch": "5.1.0",
"SemVer": "5.1.0-test.1",
"AssemblySemVer": "5.1.0.0",
"AssemblySemFileVer": "5.1.0.0",
"FullSemVer": "5.1.0-test.1+1",
"InformationalVersion": "5.1.0-test.1+1.Branch.test.Sha.24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"BranchName": "test",
"EscapedBranchName": "test",
"Sha": "24332ebe4b77f82121d1f85b4f01da9026dfd44f",
"ShortSha": "24332eb",
"VersionSourceSha": "0ada1b11d105abeda3746b1a5eefba65a497de99",
"CommitsSinceVersionSource": 1,
"CommitDate": "2025-07-28",
"UncommittedChanges": 0
}
INFO [07/29/25] Done writing
Not OK, 5.1.0.
Since that commit I can observe such behaviour. I think that corresponding part of problem in logs can be seen here:

What is expected?
I expect gitversion to use tags from working branch when operating on that branch, not from default branch.
Steps to Reproduce
Consider taking https://github.com/destructurama/attributed repo as an example:
- Clone it
- Make branch
test
from tag 4.1.0 - Type 1 symbol in readme to just make some commit.
- Commit.
- Run
gitversion PATH_TO_CLONED_REPO /diag
on b0f6c77 (outputs 4.1.1) - Run
gitversion PATH_TO_CLONED_REPO /diag
on bb071c0 (outputs 5.1.0)
RepositoryFixture Test
No response