Skip to content

Draft: PoC: Add enhanced merge method support to merged results

What does this MR do and why?

Please treat this as a Proof of Concept for now:

  • Think big picture
  • Look for holes in the overall approach
  • Avoid nitpicks and ignore test gaps

Prior to this change, the merge ref was always as a standard merge of the source branch and target branch, regardless of the merge method. With this change, we add a feature flag and project setting to allow the merged result will more closely follow the merge request and project preferences as follows:

  1. Squash if enabled on the MR
  2. Rebase if the project merge method is fast-forward or semi-linear
  3. Create a merge commit if standard merge or semi-linear

Behind the scenes, we actually implement this at the mergeability check level, since they share the ref refs/merge-requests/:iid/merge, and merged result pipelines create the ref via the mergeability check.

The project setting "Always use merge commit" is introduced for Merged Result Pipelines, enabled by default, to avoid a breaking change to users pipeline configuration. But as we are also working on supporting automatic rebase on merge, we will need to reconsider this setting:

  • If automatic rebase is enabled on merge, then the mergeability check should always perform a rebase to detect rebase-specific conflicts.
  • This means we either need to deprecate this setting or use separate refs for the mergeability check and merged result pipelines.

Part of #421025

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Hordur Freyr Yngvason

Merge request reports