Description
Using Gitversion 4.0.1-beta.1+2.Branch.master.Sha.0e77e2e16a136a1cd0f0474fe5710f617d508d81
Problem Description
Mainline works exactly as I'd expect except for when I tag a commit to a version.
For instance, I have master and develop. I make a commit to develop and merge it into master. Now both master and develop have the same HEAD at commit A.
If at this point I run gitversion on master, it'll say 0.1.1, and if I run it in develop, it'll say 0.2.0-alpha.0. This would be my expected behavior
If I tag master (Commit A) with v0.1.1 however, now if I run giversion on develop, it will now say 0.1.1 instead of 0.2.0-alpha.0. I suspect this is due to the versioning logic described of "if it sees a tag, stop processing" regardless of context.
The problem here is that if I do a pull request and merge develop, and Appveyor or someone tries to build "develop" natively, say for packaging and deployment, it will go out with the wrong version to that "prerelease" channel.
Recommended Fix
There should be an option in the .yaml file to flag non-master branches to say "if master has a tag, still process the mainline increment for gitversion based on this branch".
Suggested Name: increment-on-tag.
It could be placed in the branch context, or placed at the top to increment regardless of tags.
So if Commit A is tagged v0.1.1, and all branches have Commit A as their HEAD, I would expect to see in the gitversion output when switching to each branch:
Master: 0.1.1
Develop: 0.2.0-alpha.0 (because it defaults to Increment:Minor)
Hotfix: 0.1.2-hotfix.0 (because it defaults to Increment:Patch)
Known Workarounds
- Temporarily delete the tag, run gitversion, and then add it back (lame)
- Add an empty commit with "+semvver:skip" after every merge (lame, pollutes git history, and still increments the prerelease number unnecessarily leading to broken chains of versioning which is generally not allowed by SemVer)
- Always require net-new commits before builds in non-master branches (hard to enforce)
- Build the logic into the consumer of GitVersion that if the returned value is the same as a tag and the branch isn't master, then increment manually. (Lame, should be part of GitVersion obviously, that's its job.)
Thanks!