Skip to content

gitaly_client: Fix handling of custom hook errors in UserMergeBranch

Patrick Steinhardt requested to merge pks-gitaly-merge-custom-hook-errors into master

It was reported by users that custom hook errors aren't displayed in the UI anymore. This issue has repeatedly come up in the last few years, which is mostly because the calling convention was really bad: Gitaly must return the standard error or standard output of custom hooks as the error message without any modification, or otherwise it doesn't work.

To fix issues like this, Gitaly has introduced a new CustomHookError detailed error message: if a custom hook fails, Gitaly embeds standard output and standard error of the hook directly into a Protobuf message along with the type of the hook that was executed and returns it to the caller. The caller thus doesn't have to rely on parsing error message anymore, but can instead just have a look at whether there is such an embedded error detail and use that one instead.

Convert the operation service to handle this new error type. This once again fixes displaying hook errors in our web interface in case merging a merge request fails.

Changelog: fixed

Fixes gitaly#4167 (closed)

Merge request reports