Skip to content

Support squash and fast forward methods for merge ref operation

Problem to solve

We now create a ref for each merge request refs/merge-requests/$iid/merge that can is used by GitLab CI for testing the result of the merge, but it may not accurately reflect the likely merge ref because fast-forward and squash settings aren't considered when creating the merge ref.

Further details

Follow up to https://gitlab.com/gitlab-org/gitlab-ce/issues/47110

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24692 introduces a MergeToRefService which writes to refs/merge-requests/:iid/merge, though it currently only supports the merge method, which currently writes a new commit SHA to the ref. Ideally we should also support squash and FF-only projects / MRs.

Proposal

  1. This will probably require a new RPC UserFfToRef (as opposed to UserMergeToRef we currently have).
  2. Change MergeToRefService to use it instead raising an "unsupported" error

Links / references

Edited by James Ramsay (ex-GitLab)