From: Patrick Steinhardt Date: Wed, 16 Aug 2023 06:06:59 +0000 (+0200) Subject: upload-pack: fix exit code when denying fetch of unreachable object ID X-Git-Tag: v2.42.1~29^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f33a843de91f40ab2335e61d4373ace87301b07;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/upload-pack.c b/upload-pack.c index ece111c629..15f3318d6d 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -782,7 +782,7 @@ error: packet_writer_error(&data->writer, "upload-pack: not our ref %s", oid_to_hex(&o->oid)); - exit(1); + exit(128); } } }