]> git.ipfire.org Git - thirdparty/git.git/commitdiff
upload-pack: fix exit code when denying fetch of unreachable object ID
authorPatrick Steinhardt <ps@pks.im>
Wed, 16 Aug 2023 06:06:59 +0000 (08:06 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 16 Aug 2023 16:17:46 +0000 (09:17 -0700)
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

index ece111c629be7156e04c1ee82d1674ef08b4c730..15f3318d6d05f5bc4f19a861996a17fbbe61b531 100644 (file)
@@ -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);
                }
        }
 }