On our feature branches, if we include +semver: patch in the commit message, to manually increment the patch, we are seeing that this isn't honoured and the semver remains the same as the previous build on the feature branch.
(As per https://gitversion.readthedocs.io/en/latest/more-info/version-increments/)
I've done some more digging and have created the following unit test on the v3.5.4 tag to capture the issue:
[Test]
public void CanUseCommitMessagesToBumpPatchVersion()
{
using (var fixture = new EmptyRepositoryFixture())
{
fixture.Repository.MakeACommit();
fixture.MakeATaggedCommit("1.0.0");
fixture.Repository.MakeACommit("+semver:patch");
fixture.AssertFullSemver("1.0.1+1"); // WORKS!
fixture.Repository.MakeACommit("+semver:patch");
fixture.AssertFullSemver("1.0.2+2"); // FAILS - result is 1.0.1+2
}
}
Delving into the code, it's because it applies the commit messages patch increment to the branches base semver, not the current semver. The documentation is not explicit about how it _should_ work, but as it's there to help get around nuget package manager issues, I would have expected that it increments the patch regardless.
This is intended behaviour.
GitVersion uses tags to know when a package has been released. +semver: patch or other bumping commits aggregate for a release. This is so if you merge two pull requests both making minor changes you only get a single minor bump.
v4 has a mainline mode, which infers a release for every merged pull request and every direct commit. So mainline mode would work as you expect above.
I've noticed the same thing and based upon documentation would expect it to behave as @drewwilliams1982 noted.
@sdunnin: Any reason why you can't use mode: Mainline and version 4 of GitVersion?
To clarify why this is:
I release v2.0.0 of my application. Then myself and another of my team members both add a new feature and we both use +semver: minor. Both pull requests get merged, if you are using continuous delivery then you would only want minor to be increased once because at some point you will release a new release with multiple new features and fixes and you only want to increment minor once and have patch at 0 to adhere to SemVer.
Mainline mode will bump each merge commit based on what +semver: directive is in the commits which were merged in. So in the above sample mainline would increment minor twice.
Hope that helps!