I just upgrade to the dotnet global of GitVersion (version 4.0.1-beta1-58) and my version number jumped all of a sudden. With the previous version of GitVersion, my master branch was detected as 0.325.3 by GitVersion. Now that I changed the version of GitVersion, the following commit on master resulted in a version equal to 1.245.4.
Here are the relevant parts that I see in the output of GitVersion:
...
[15:46:07]refs/tags/v0.325.3 (4eb307e85ac48717b4f30ca48d52a7b8dcaba87e)
...
[15:46:08] INFO [02/07/19 20:45:56:14] Fallback base version: 0.1.0 with commit count source 16ce893afb31f6356d00b0356a2f71ac36e91aca (Incremented: None)
[15:46:09] INFO [02/07/19 20:45:57:56] Git tag 'v0.325.3': 0.325.3 with commit count source 4eb307e85ac48717b4f30ca48d52a7b8dcaba87e (Incremented: 0.325.4)
[15:46:09] INFO [02/07/19 20:45:57:56] Git tag 'v0.325.2': 0.325.2 with commit count source 8f067b7888c8ba14a1a51ebcdc088e1dd27efe73 (Incremented: 0.325.3)
...
[15:46:25] INFO [02/07/19 20:46:13:84] Direct commit on master 4eb307e85ac48717b4f30ca48d52a7b8dcaba87e incremented base versions Patch, now 1.245.3
[15:46:25] INFO [02/07/19 20:46:13:84] Merge commit fe8b01ef0d5d5db1800389baba3020073b995b28 incremented base versions Patch, now 1.245.4
[15:46:25] INFO [02/07/19 20:46:13:92] 6577 commits found between d2ab1b9dbac2f18d581bca167924484e64bb721d and fe8b01ef0d5d5db1800389baba3020073b995b28
[15:46:25]INFO [02/07/19 20:46:13:92] End: Using mainline development mode to calculate current version (Took: 16,076.37ms)
As you can see, I have a tag v0.325.3 for commit 4eb30 but gitversion seems to ignore it.
Here's my GitVersion.yml if it can help.
major-version-bump-message: '(breaking|major)\(.*\)\s*\:'
minor-version-bump-message: '(feat|minor)\(.*\)\s*\:'
patch-version-bump-message: '(fix|patch)\(.*\)\s*\:'
commit-message-incrementing: Disabled
mode: Mainline
branches:
feature:
regex: feat?[/-]
mode: ContinuousDeployment
tag: 'feat-{BranchName}'
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
pull-request:
regex: (pull|pull\-requests|pr)[/-]
mode: ContinuousDeployment
tag: feat-{BranchName}
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
ignore:
sha: []
And here's the full output of GitVersion.
git_version_output.txt
Anybody could have a look at this? It seems pretty critical to have such a breaking change...
Can you try using the latest 5.0.0-beta1-26? and see if it's working?
We had to revert some changes introduced in versions between 4.0.0-beta1-51 and 4.0.0-beta1-59.
Same problem. Here are my repro steps:
Check-out my tag and create a new branch:
PS > git checkout v0.325.2
PS > git checkout -b feat/git-version-problem
Check what GitVersion says. As you can see, GitVersion detects 0.325.2 correctly.
PS > dotnet tool install --global GitVersion.Tool --version 4.0.1-beta1-58
PS > dotnet-gitversion
{
"Major":0,
"Minor":325,
"Patch":2,
"PreReleaseTag":"",
"PreReleaseTagWithDash":"",
"PreReleaseLabel":"",
"PreReleaseNumber":"",
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.feat/git-version-problem.Sha.8f067b7888c8ba14a1a51ebcdc088e1dd27efe73",
"MajorMinorPatch":"0.325.2",
"SemVer":"0.325.2",
"LegacySemVer":"0.325.2",
"LegacySemVerPadded":"0.325.2",
"AssemblySemVer":"0.325.2.0",
"AssemblySemFileVer":"0.325.2.0",
"FullSemVer":"0.325.2",
"InformationalVersion":"0.325.2+Branch.feat/git-version-problem.Sha.8f067b7888c8ba14a1a51ebcdc088e1dd27efe73",
"BranchName":"feat/git-version-problem",
"Sha":"8f067b7888c8ba14a1a51ebcdc088e1dd27efe73",
"ShortSha":"8f067b7",
"NuGetVersionV2":"0.325.2",
"NuGetVersion":"0.325.2",
"NuGetPreReleaseTagV2":"",
"NuGetPreReleaseTag":"",
"CommitsSinceVersionSource":6571,
"CommitsSinceVersionSourcePadded":6571,
"CommitDate":"2019-02-07"
}
I now create a commit and see what git version 4.0.1-beta1-58 says:
PS > git commit -m 'empty commit' --allow-empty
[feat/git-version-problem c4e9b2a90] feat:empty commit
PS > dotnet-gitversion
{
"Major":1,
"Minor":1,
"Patch":0,
"PreReleaseTag":"feat-git-version-problem.6572",
"PreReleaseTagWithDash":"-feat-git-version-problem.6572",
"PreReleaseLabel":"feat-git-version-problem",
"PreReleaseNumber":6572,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.feat/git-version-problem.Sha.c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"MajorMinorPatch":"1.1.0",
"SemVer":"1.1.0-feat-git-version-problem.6572",
"LegacySemVer":"1.1.0-feat-git-version6572",
"LegacySemVerPadded":"1.1.0-feat-git-version6572",
"AssemblySemVer":"1.1.0.0",
"AssemblySemFileVer":"1.1.0.0",
"FullSemVer":"1.1.0-feat-git-version-problem.6572",
"InformationalVersion":"1.1.0-feat-git-version-problem.6572+Branch.feat/git-version-problem.Sha.c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"BranchName":"feat/git-version-problem",
"Sha":"c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"ShortSha":"c4e9b2a",
"NuGetVersionV2":"1.1.0-feat-git-version6572",
"NuGetVersion":"1.1.0-feat-git-version6572",
"NuGetPreReleaseTagV2":"feat-git-version6572",
"NuGetPreReleaseTag":"feat-git-version6572",
"CommitsSinceVersionSource":6572,
"CommitsSinceVersionSourcePadded":6572,
"CommitDate":"2019-02-15"
}
As mentionned in the original issue, the version jumps to 1.1.
I now try to update GitVersion to 5.0.0-beta1-26 as suggested:
PS > dotnet tool uninstall --global GitVersion
PS > dotnet tool install --global GitVersion.Tool --version 5.0.0-beta1-26
You can invoke the tool using the following command: dotnet-gitversion
Tool 'gitversion.tool' (version '5.0.0-beta1-26') was successfully installed.
PS > dotnet-gitversion
{
"Major":1,
"Minor":1,
"Patch":0,
"PreReleaseTag":"feat-git-version-problem.6572",
"PreReleaseTagWithDash":"-feat-git-version-problem.6572",
"PreReleaseLabel":"feat-git-version-problem",
"PreReleaseNumber":6572,
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.feat/git-version-problem.Sha.c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"MajorMinorPatch":"1.1.0",
"SemVer":"1.1.0-feat-git-version-problem.6572",
"LegacySemVer":"1.1.0-feat-git-version6572",
"LegacySemVerPadded":"1.1.0-feat-git-version6572",
"AssemblySemVer":"1.1.0.0",
"AssemblySemFileVer":"1.1.0.0",
"FullSemVer":"1.1.0-feat-git-version-problem.6572",
"InformationalVersion":"1.1.0-feat-git-version-problem.6572+Branch.feat/git-version-problem.Sha.c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"BranchName":"feat/git-version-problem",
"Sha":"c4e9b2a903a041884743b41a1654dc1eafdbccd3",
"ShortSha":"c4e9b2a",
"NuGetVersionV2":"1.1.0-feat-git-version6572",
"NuGetVersion":"1.1.0-feat-git-version6572",
"NuGetPreReleaseTagV2":"feat-git-version6572",
"NuGetPreReleaseTag":"feat-git-version6572",
"CommitsSinceVersionSource":6572,
"CommitsSinceVersionSourcePadded":6572,
"CommitDate":"2019-02-15"
}
As you can see, the version still jumps to 1.1.
Am I the only one to see this problem? It seems pretty critical to me if gitversion can't provide a version number reliably using the tags as it explain in the documentation.
I believe I'm seeing the same issue on 4.0.0+Branch.master.Sha.e715eb5dd515037d90a257f527e62442cae8c1c5. If I'm on a tagged commit the version is reported correctly. If I'm not it assumes the root commit is the default version and then calculates from there.
I believe this repo reproduces the issue.
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.
@WesToleman, using v0.0.0 as a tag indeed sounds like something GitVersion doesn't support. If it did before, that was unintentional and the breakage in newer versions are just as unintentional.
@mabead, could you please add a failing test as a PR to purport the problem you're seeing? I'm having a hard time visualizing your Git graph just based on your textual descriptions.
Not prefixing my tags with v indeed fixes the problem:
PS > git checkout v0.325.2
PS > git tag 0.325.2
PS > git checkout -b feat/git-version-problem
PS > git commit -m 'empty commit' --allow-empty
PS > dotnet-gitversion
{
"Major": 0,
"Minor": 326,
"Patch": 0,
"PreReleaseTag": "feat-git-version-problem.7",
"PreReleaseTagWithDash": "-feat-git-version-problem.7",
"PreReleaseLabel": "feat-git-version-problem",
"PreReleaseNumber": 7,
"WeightedPreReleaseNumber": 30007,
"BuildMetaData": "",
"BuildMetaDataPadded": "",
"FullBuildMetaData": "Branch.feat/git-version-problem.Sha.13b57ea07d67e96f04caaf02e1b73a8ba7648e81",
"MajorMinorPatch": "0.326.0",
"SemVer": "0.326.0-feat-git-version-problem.7",
"LegacySemVer": "0.326.0-feat-git-version-pr7",
"LegacySemVerPadded": "0.326.0-feat-git-version0007",
"AssemblySemVer": "0.326.0.0",
"AssemblySemFileVer": "0.326.0.0",
"FullSemVer": "0.326.0-feat-git-version-problem.7",
"InformationalVersion": "0.326.0-feat-git-version-problem.7+Branch.feat/git-version-problem.Sha.13b57ea07d67e96f04caaf02e1b73a8ba7648e81",
"BranchName": "feat/git-version-problem",
"Sha": "13b57ea07d67e96f04caaf02e1b73a8ba7648e81",
"ShortSha": "13b57ea",
"NuGetVersionV2": "0.326.0-feat-git-version0007",
"NuGetVersion": "0.326.0-feat-git-version0007",
"NuGetPreReleaseTagV2": "feat-git-version0007",
"NuGetPreReleaseTag": "feat-git-version0007",
"VersionSourceSha": "dd3a4d34568bdf40c699cf8bae2d3ca29f505832",
"CommitsSinceVersionSource": 7,
"CommitsSinceVersionSourcePadded": "0007",
"CommitDate": "2019-07-23"
}
Thanks @asbjornu. Closing...
Why would you close this
Most helpful comment
Why would you close this