At #2205815: Merge requests in Drupal.org issue queues?, I wrote:

How do maintainers enable no-fast-forward (--no-ff or merge) commits? When I went to merge an MR recently, it said it was going to be a fast-forward commit, and there didn't appear to be a way to change it, which is actually the default Gitlab behaviour.

Merge commits are good because the provide contextual metadata:

  1. they package the associated commits together, and allow folks to reference the issue and MR from looking at the tree (if, say, committers forgot to mention the ticket number in the message), and
  2. the entire MR can be reverted at once without having to deal with finding the individual commits and reverting those (which is very time consuming).

If it can't be the default behaviour, can there at least be an option to change it?

And then @drumm responded:

Yes, please do open a child issue for this. To minimize disruption, the default merge strategy is set to mirror the patch workflow as much as possible. There isn’t going to be one single best merge strategy for every project, so we should provide the options. #3072047: Handle merging of merge requests has some details on the current implementation.

This is that child issue. :)

Upstream blockers

Comments

colan created an issue. See original summary.

drumm’s picture

GitLab currently has 3 options:

Screenshot of GitLab merge method options

There are also options for squashing:

Screenshot of GitLab’s squash commits when merging options

However, we can’t set those for a project yet, https://gitlab.com/gitlab-org/gitlab/-/issues/261458. This still may be a useful setting for doing the merges via Drupal.org, we can specify squashing with each individual merging.

I think the merge UI on Drupal.org’s issue pages should respect these options. To reduce the number of API requests to GitLab during a merge, we should store a copy of each setting in fields for each project node. (Especially since we can’t set the project’s squashing behavior via GitLab’s API.)

colan’s picture

Projects API show whether a project requires/prevents squashing is now in. Are there any other upstream blockers we should be tracking here?

drumm’s picture

I believe that’s only for showing the data, not modifying it. https://gitlab.com/gitlab-org/gitlab/-/issues/333945 remains open for the option to change the merge strategy.

colan’s picture

Issue summary: View changes

Added these to the IS.

drumm’s picture

Status: Active » Closed (outdated)

GitLab 15.4 has moved the merge options, so they are now available to be set: https://about.gitlab.com/releases/2022/09/22/gitlab-15-4-released/#dedic...

Go directly to “Merge requests” under the project settings.