Skip to content

Improve merge error when pre-receive hooks fail in fast-forward merge

Stan Hu requested to merge sh-improve-pre-receive-error-ff-merge-message into master

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 exceptions_json.log, this kept users in the dark.

Gitaly prefaces the error response status from the /internal/allowed API call with GitLab: (, 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)

Edited by Stan Hu

Merge request reports