Skip to content

Configurable defaults for "Squash commits" option

Samantha Ming requested to merge 17613-fe-squash-commits-options into master

Issue #17613 (closed)

MR Changes
Part 1 > !33099 (merged) BE implementation
👉 Part 2 (current) FE implementation of squash option and MR form
Part 3 > !34891 (merged) FE implementation of squash option in MR widget
Part 4 > !35081 (merged) FE implementation of squash option tooltip
Part 5 > !35111 (merged) FE implementation of squash option message in MR form
Part 6 > !35392 (merged) Additional spec for testing edge case for part 2
Docs > !33930 (merged) Documentation

What does this MR do?

Add squash commits options to the general settings and updates the merge options checkbox to reflect the selected squash option.

Testing Case

This is hidden behind a feature flag, docs

rails c

Feature.enable(:squash_options)

General Settings

  1. Go to the Settings > General page > expand Merge requests
  • You will see the following squash options

image

Merge Request Form

  1. Go to New Merge Request
  • the Merge options will have the following depending on the selected squash options.
Squash options Expectation Screenshot
Do not allow box unchecked, disabled hidden
Allow (default) box unchecked, enabled _
Encourage box checked, enabled _
Require box checked, disabled _
  1. Go to Edit Merge Request

If there is persisted data (meaning the user has personally selected the squash option), the rules will be as followed:

Squash options Result
Do not allow hidden
Allow MR setting if set, else go with Project setting
Encourage MR setting if set, else go with Project setting
Require Project setting, ignore MR setting

Rules

!33827 (comment 370380742)

Required

Recovers what is saved last (The "Required" state can be saved and will override the original MR state)

  1. Existing MR is unchecked
  2. Maintainer changes it to "Required" (checked)
  3. Go to edit MR, which is disabled and checked. Clicks "save".
  4. Maintainer changes it to be "Allow" (unchecked)
  5. Go to edit MR, squash commit will recover the latest saved state, which is that of the Project setting state, and displays checked

Do not allow

Recovers MR state (The "Do not allow" is never saved)

  1. Existing MR has checked
  2. Maintainer changes it to "Do not allow" (unchecked)
  3. Go to edit MR, there is no squash option. Clicks "save".
  4. Maintainer changes it to be "Allow" (uncheck)
  5. Go to edit MR, squash commit will recover the MR state and displays checked

Special Thanks

This MR is based on @enzuru's MR > !27833 (closed). Thank you for your contribution 🧡

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #17613 (closed)

Edited by Thong Kuah

Merge request reports