Skip to content

updateref: Ignore failures of custom post-receive hooks

The post-receive hook run by git-receive-pack(1) is special compared to all the other hooks because any errors returned by it have no impact on the end result of git-receive-pack(1). This is because the hook runs after references have been updated already, so it cannot have any impact on the end result anymore.

Our hooks updater, which emulates roughly the same semantics for hooks execution as git-receive-pack(1), behaves differently though and will in fact report any custom-hook errors to the caller. This has the result that depending on how the post-receive hook is executed, an error code has different impacts.

Align the behaviour of the hooks updater to match what Git is doing and ignore errors returned by custom hooks. Any custom hooks which relied on this exact behaviour were broken already because the error code wouldn't have changed the outcome, and neither would the hook work correctly when executed by git-receive-pack(1). This thus shouldn't be a breaking change, but at most fix behaviour in context of misbehaving post-receive hook scripts.

Fixes #3595 (closed).

Edited by Patrick Steinhardt

Merge request reports