question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitVersion not using my tags anymore

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
jzabroskicommented, Nov 26, 2019

Why would you close this

2reactions
mabeadcommented, Jul 23, 2019

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

git tags are not recognized anymore
I got a weird problem with my git repository. It suddently "stopped" working with tags. I can create tags, i can list tags....
Read more >
Configuration
If you are using next-version and are experiencing weird versioning behaviour, please remove it, create a git tag with an appropriate version number...
Read more >
How it works
If the current commit is tagged, the tag is used and build metadata (excluding commit count) is added. The other two steps will...
Read more >
Tags and gitversion : r/azuredevops
My pipeline uses gitversion to get the semver to embed in code… ... DevOps is not displaying it in the ui and using...
Read more >
No 'git' executable was found. Please install Git on your ...
I get this error when I add git repo to packages. Unity 2019.3.0a11. How can I solve this?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found