Skip to content

Commit 5f33a84

Browse files
pks-tgitster
authored andcommitted
upload-pack: fix exit code when denying fetch of unreachable object ID
In 7ba7c52 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7ba7c52 commit 5f33a84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

upload-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ static void check_non_tip(struct upload_pack_data *data)
782782
packet_writer_error(&data->writer,
783783
"upload-pack: not our ref %s",
784784
oid_to_hex(&o->oid));
785-
exit(1);
785+
exit(128);
786786
}
787787
}
788788
}

0 commit comments

Comments
 (0)