Skip to content

Hide "Merge immediately" button when fast-forward is not possible

What does this MR do and why?

We've recently implemented automatic rebase on merge for fast-forward merge trains. This had the unintended consequence making the Merge immediately button available when it shouldn't be (because an immediate fast-forward merge is not possible when the source branch is behind the target branch).

In this MR, we add logic to hide this button when fast-forward merge trains are enabled and the MR cannot be merged immediately.

Part of #434070

Screenshots or screen recordings

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

Before After
Screenshot_2023-12-05_at_8.22.16_PM Screenshot_2023-12-05_at_8.18.46_PM

How to set up and validate locally

  1. Run bin/rake gitlab:seed:merge_trains:project. This will generate a project with a bunch of MRs.
  2. In the generated project, ensure fast-forward (or semi-linear) merges are enabled, along with merge trains
  3. Check an arbitrary MR in the project. Observe that the Merge immediately option is available (because the MR is up-to-date).
  4. Merge the MR or make a change directly to the default branch, that the rest of the MRs are behind by at least one commit.
  5. Check another MR. Observe that the Merge immediately option is not available.

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