Skip to content

[Feature] Patch version not incrementing based on commit message #3494

@andreear-23

Description

@andreear-23

Describe the bug
It seems the patch version does not increment properly based on commit message keywords. It seemed to work when I tested it last month but now I'm having some issues with this.

Expected Behavior

Doing a commit with the keywords +semver:fix additional text or +semver:patch additional text should increase the patch version.

For example the current gitversion is 1.0.1-dev.19, I do a git commit --allow-empty -m "added a fix for bug +semver:fix"

I expect the next gitversion to be 1.0.2-dev.20.

Actual Behavior

Following the example from above, the actual gitversion generates: 1.0.1-dev.20

Context

I am trying to use gitversion for setting the version of a pip library automatically. Initially when I tested it I had some issues with incrementing the patch value that went away after I removed the next-version flag from GitVersion.yml.

Furthermore I had issues due to some existing incompatibilities between gitversion and PEP440 specification so I needed to tweak the tags that get generated by gitversion. Finally I decided to just use the Major.Minor.Patch version so there are no more complications.

I added a tag v1.0.0 on my feature branch that introduced support for gitversion such that all future versions are computed from that.
So now my devel branch has gitversion: 1.0.1.
I want to merge in a feature branch that adds some additional scripts and I added in one of the commit messages +semver:fix but it did not change the Patch value.

Maybe I am misunderstanding the way the keywords in commit messages are impacting the generated SemVer but my impression is that if I have a feature branch that starts at version 1.0.1 and I do 3 commits and 2 of those commits contain the +semver: fix keyword, the version I should get when I merge the PR into devel should be at least 1.0.3.

Your Environment

Using unix-based environment, however gitversion tool is running inside a docker container.
Version of gitversion /version: 5.10.3+Branch.support-5.x.Sha.bc9c9d003e655385e3dd1ba3bd013e04062d2f9b

  • Version Used: Using Ubuntu 20.04 for development, the docker image is based also on Ubuntu 20.04.4 LTS.

My GitVersion.yml file looks like this:

mode: Mainline
commit-message-incrementing: Enabled
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
branches:
  master:
    regex: ^master$|^main$
    tag: ''
  release:
    tag: 'rc'
  feature:
    tag: 'a'
    regex: ^feature[/]
  develop:
    regex: ^dev(el)?(op)?(ment)?$
    tag: 'dev'
  hotfix:
    tag: 'post'
    regex: ^hotfix|^bugfix
ignore:
  sha: []
merge-message-formats: {}
 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions