Skip to content

updateref: return proper error when writing to closed process

Sami Hiltunen requested to merge smh-fix-updateref-errors into master

update-ref closes when it encounters it encounters an error while processing a transaction. This could happend for example due to an invalid reference name. When the process exits, further writes into its stdin will fail with a broken pipe error. This is undesired as this is not the real reason why the write failed but rather that the process exited due to a previous error. This causes problems for callers which expect typed errors to be returned and impacts observability as wrong error will be logged. This commit fixes the issue by returning a typed error if the stderr contains a matching error message. This way the callers get the errors they expect to receive no matter when the process closes due to an error.

Changelog: fixed

Closes #4750 (closed)

Merge request reports