GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

[Bug] Merging remote main into main should count commits from both sources

Open gautelo opened this issue 3 years ago • 1 comments

Describe the bug With Mainline mode, I am able to create duplicate semver. I create N local commits. Somebody pushes N + 1 commits before I push mine. The merge commit from git pull will reuse the last semver.

Expected Behavior

GitVersion should recognize that it needs to count all commits from both variants of the same branch from the merge commit message, which would be something like "Merge branch 'main' of {remote}"

Actual Behavior

GitVersion treats the remote main as a non-mainline branch and increments using only the local N commits plus the merge commit.

Possible Fix

Use commit message to recognize sameness of remote and local branches.

Context

It causes my build to crash because of duplicate NuGet packages being generated.

Your Environment

Irrelevant. Will provide PR with failing test.

gautelo avatar Jun 29 '21 14:06 gautelo

Does #2750 explain this sufficiently?

asbjornu avatar Mar 03 '22 22:03 asbjornu

Sorry, forgot about this completely. I'm not sure I agree that this could not be fixed, but it's not the greatest deal. It's just an unsupported scenario where the solution is two-fold:

  1. Rebase merge if multiple people are committing to the same branch.
  2. Try to avoid that by using task branches instead of having multiple people on the same branch.

In short, we've improved our workflow to where this isn't hindering us. Hence, closing this.

gautelo avatar Feb 25 '23 17:02 gautelo