Skip squashing with only one commit in a merge request
We noticed in https://gitlab.com/gitlab-org/gitaly/issues/2395 that the backend was unnecessarily attempting to squash merge requests with one commit. This happened because `SquashService` skips the squash if two conditions are met: 1. The number of commits < 2 2. The `squash_commit_message` is null If a `squash_commit_message` is passed, this indicates that the user wants the squashed commit to have a different commit message. By default, the frontend always sends `squash_commit_message`, regardless of whether the squash button is available in the merge request. With this change, the frontend will only send this parameter if the button is shown (i.e. when the commit count is >= 2). Alternatively, we could also change the backend to skip squashing if only the first condition is met. Closes https://gitlab.com/gitlab-org/gitlab/issues/198971
Showing
Please register or sign in to comment