Allow setting --squash-before-merge explicitly to false in glab mr create command
Problem to solve
We have our Gitlab project set to check the 'squash on merge' checkbox on MRs by default. This is the behaviour we want for almost all MRs.
However, we also have a scenarios where an MRs is created by a script that we do not want to be squashed. Specifically, we create a release in a branch that is then merged back into the main branch, and we want the specific tagged release commit to be merged.
Up until recently, we could accomplish this fine using glab mr create because the 'squash before mergecheckbox was unticked for all MRs created withglab, regardless of project settings. Recently, this has changed. When we create an MR with glab`, the checkbox is ticked by default.
Proposal
Allow explicitly setting --squash-before-merge=false to override project default settings.
Further details
When looking to see if this was already reported, I found #1142. That implies that the new behaviour of using the project settings is probably desired by some users, even though it has broken our workflow. That is why I opened this as a feature request instead of a bug report.
Links / references
- This appears to be where the CLI flag is used to set the corresponding API parameter, only if it is true: https://gitlab.com/gitlab-org/cli/-/blob/58a2040fa765427398d1ce0111ae4f91821947a3/internal/commands/mr/create/mr_create.go#L536
- API docs for creating an MR. Note that the
--squashparameter docs now say "When not provided, defaults to the project’s squash option setting.": https://docs.gitlab.com/api/merge_requests/#create-a-merge-request