Skip to content

Mainline mode with master, develop and feature branch: +semver commit messages in feature are applied twice #1573

@GeorgDangl

Description

@GeorgDangl

I'm doing mainline development with the following setup:

  • All commits to master produce a stable version
  • develop is merged into master, solo-development is usually done on develop
  • I split bigger features in a feature/ branch, which then gets merged back into develop

Here's my GitVersion.yml:

assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
mode: Mainline

branches:
  master:
    regex: (origin/)?master
  develop:
    increment: Patch
    tag: beta
    regex: (origin/)?dev(elop)?(ment)?$
  feature:
    increment: Inherit

Here's the history of the latest work:

mainline
The latest commit on master in this case is tagged with v2.0.0.

There's one commit which contains +semver: minor in it's message. This is working fine while I'm on the feature branch and produces versions 2.1.0. However, after the merge to develop, it produces 2.2.0.

Running GitVersion.CommandLine.exe with the /diag switch shows this:

01: INFO [01/28/19 22:54:31:99] End: Calculating base versions (Took: 1,148.00ms)
02: INFO [01/28/19 22:54:31:99] Begin: Using mainline development mode to calculate current version
03:   INFO [01/28/19 22:54:32:03] Multiple possible mainlines pointing at the same commit, dropping origin/master
04:   INFO [01/28/19 22:54:32:03] Found possible mainline branches: master
05:   INFO [01/28/19 22:54:32:05] Mainline for current branch is master
06:   INFO [01/28/19 22:54:32:09] Merge commit f9d212493e37175a7dce6497e2200b276e63e341 incremented base versions Minor, now 2.1.0
07:   INFO [01/28/19 22:54:32:10] Current branch (develop) was branch from 558d0d7a3820c81105cbdf2a27fc6123630f8361
08:   INFO [01/28/19 22:54:32:13] 16 commits found between 558d0d7a3820c81105cbdf2a27fc6123630f8361 and f9d212493e37175a7dce6497e2200b276e63e341
09:   INFO [01/28/19 22:54:32:13] Performing Minor increment for current branch
10: INFO [01/28/19 22:54:32:13] End: Using mainline development mode to calculate current version (Took: 138.01ms)
11: INFO [01/28/19 22:54:32:14] Begin: Getting version tags from branch 'refs/heads/develop'.
12: INFO [01/28/19 22:54:32:19] End: Getting version tags from branch 'refs/heads/develop'. (Took: 51.00ms)

On line 06, it increments the version via the merge commit (I think because of the found +semver: minor), but the minor version is again incremented on line 09. If I use +semver: major or +semver: patch, the behavior is the same - major or patch is incremented twice. When +semver is used in the merge message instead of a simple commit inside the feature branch, the behavior is the same. +semver: skip leads to 2.0.0, meaning it also loses the default increment of patch as specified in branch develop.

The latest merge into master produces again a correct version of 2.1.0.

This happens both with the latest stable 4.0.0 and 4.0.1-beta1-59.

I'd be happy for any guidance or a workaround!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions