upload-pack: fix exit code when denying fetch of unreachable object ID
commit5f33a843de91f40ab2335e61d4373ace87301b07
authorPatrick Steinhardt <ps@pks.im>
Wed, 16 Aug 2023 06:06:59 +0000 (16 08:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Aug 2023 16:17:46 +0000 (16 09:17 -0700)
tree81a48af8fdb7d99d84ceb5a89fdc3c26e49b8e3a
parent7ba7c52d76630183b47c57bdd2da8eea033bdd2f
upload-pack: fix exit code when denying fetch of unreachable object ID

In 7ba7c52d76 (upload-pack: fix race condition in error messages,
2023-08-10), we have fixed a race in t5516-fetch-push.sh where sometimes
error messages got intermingled. This was done by splitting up the call
to `die()` such that we print the error message before writing to the
remote side, followed by a call to `exit(1)` afterwards.

This causes a subtle regression though as `die()` causes us to exit with
exit code 128, whereas we now call `exit(1)`. It's not really clear
whether we want to guarantee any specific error code in this case, and
neither do we document anything like that. But on the other hand, it
seems rather clear that this is an unintended side effect of the change
given that this change in behaviour was not mentioned at all.

Restore the status-quo by exiting with 128.  The test in t5703 to
ensure that "git fetch" fails by using test_must_fail, which does
not care between exiting 1 and 128, so this changes will not affect
any test.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
upload-pack.c