Skip to content

Issue when merging master to a branch and then back to master using Mainline #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 24, 2016

Conversation

markryd
Copy link

@markryd markryd commented Aug 22, 2016

When using Mainline after merging in a feature branch that has had master merged into it, GitVersion doesn't seem to correctly track the merge commits it should pay attention to.

See the snappily named VerifyMergingMasterToFeatureDoesNotCauseBranchCommitsToIncrementVersion test. When we create a feature branch, then merge master into it, then tag master and merge the feature branch in, we should only be at one merge commit past the tag, but FindMainlineModeVersion treats the merge from master to our branch as a merge into master, and commits before it as master commits.

I have a fix here that uses the FirstParentOnly flag on CommitFilter and make sure merges are to our target branch. I feel like I should be able to use that directly in the query for commitLog but that causes VerifySupportForwardMerge to fail, hence the dual queries shown.

@markryd
Copy link
Author

markryd commented Aug 22, 2016

After looking closer at the VerifySupportForwardfMerge test it doesn't work as I expected, perhaps I'm not understanding Mainline completely?

            fixture.MakeACommit("+semver: minor");
            fixture.AssertFullSemver(config, "1.1.0");
            fixture.MergeNoFF("support/1.0");
            fixture.AssertFullSemver(config, "1.1.2");

After this line I would expect the version to be 1.1.1? Master was at 1.1.0 and we merge in a single change. I didn't think it would matter how many commits were in the feature branch.

If this test is updated for that behavior, all tests pass just by changing the commitLog query in NextVersionCalculator to use FirstParentOnly.

@JakeGinnivan
Copy link
Contributor

I think you are right.

A lot of mainline is pretty rushed, if it doesn't look like it makes sense then it may not :P I think it should be changed to 1.1.1 as you say.

Mark Rydstrom added 3 commits August 23, 2016 17:47
The number of commits in a branch merged into master shouldn't change
that we increment by a single version
This prevents us from picking up merges we don't care about
@markryd
Copy link
Author

markryd commented Aug 23, 2016

Okay that simplifies the fix a bunch. Updated.

@JakeGinnivan
Copy link
Contributor

Nice!

@JakeGinnivan JakeGinnivan merged commit 5dce5c1 into GitTools:master Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants