Always compute mainline version with mainline commits #1540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Query the mainline commit log starting from mainline tip regardless of the current branch. Stop considering mainline commits after the merge root for the current branch (or, if the current branch has been merged to mainline but has new commmits, the last commit that merged the current branch into mainline). This keeps the mainline version consistent on long-lived branches that may be merged into mainline many times, such as the
develop
branch in the GitFlow model.When there is more than one potential mainline branch, before falling back to the first branch in the list, choose 1) the current branch, if it is a possible mainline; or 2) the first potential mainline from which
the current commit is reachable in a FirstParentOnly walk (i.e. is a direct commit on that branch).
Additionally, don't discard potential mainlines with equal tip because it might reduce the effectiveness of the new heuristics. Generally speaking, this makes the calculation of mainline version more stable along support branches by treating the support branch as mainline.
fixes #1035