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 |
---|---|
How to set up and validate locally
- Run
bin/rake gitlab:seed:merge_trains:project
. This will generate a project with a bunch of MRs. - In the generated project, ensure fast-forward (or semi-linear) merges are enabled, along with merge trains
- Check an arbitrary MR in the project. Observe that the
Merge immediately
option is available (because the MR is up-to-date). - 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.
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Hordur Freyr Yngvason