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.

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

See original GitHub issue

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!

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
GeorgDanglcommented, Oct 16, 2019

Bad bot

1reaction
GeorgDanglcommented, Oct 19, 2019

I’ll try to recreate it, and maybe even try to see if I can submit a PR. Thanks for the tip with the test setup!

Read more comments on GitHub >

github_iconTop Results From Across the Web

gitversion mainline not correctly basing version off of ...
I see that you set both is-release-branch: true and is-mainline: true in your master branch configuration. The documentation says that ...
Read more >
Mainline Development
The main rule of mainline development is that main is always in a state that it could be deployed to production. This means...
Read more >
Automatic semantic versioning (bonus: with release notes!)
Learn how to configure automatic semantic versioning based on the pull ... We need the commit messages of the feature branch (with +semver:...
Read more >
How to use GitVersion to get sensible versioning
GitVersion assumes that new functionality is developed on the develop branch, and by default, it assumes it will be backwards compatible.
Read more >
Squash, Merge, or Rebase? : r/programming
A develop branch which you squash and merge PRs into and then you regular merge that onto master and tag a new release....
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