When fast-forward merge is enabled, merges might fail due to a failed pre-receive check (e.g. due to file locks, commit message push rules, etc.) but the UI would only display:
Merge failed: pre-receive hook failed. Please try again.
While the raw message was logged in Sentry and in
this kept users in the dark.
Gitaly prefaces the error response status from the
API call with
GitLab: (https://gitlab.com/gitlab-org/gitaly/blob/463ffcc21ba0ebdc63dee18aae1e0aba6d293bae/internal/gitaly/hook/prereceive.go#L83), so we can use this to display the error to the
user. We now only fallback to a default if we do not have anything to
show. Now, users see a more informative message, such as:
Merge failed: Commit message does not follow the pattern 'MERGEME'. Please try again.
!44844 (merged) will fix the escaping.
Relates to #246816 (closed)