upload-pack: report "not our ref" to client

Make upload-pack report "not our ref" errors to the client as an "ERR" line. (If not, the client would be left waiting for a response when the server is already dead.) Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed Feb 23, 2017 at 10:43 UTC bdb31eada76fd27d18e981c3b40889297fa889c6
1 file changed +5 -1
upload-pack.c
+5 -1
@@ -822,9 +822,13 @@ static void receive_needs(void)
822 use_include_tag = 1;
823
824 o = parse_object(sha1_buf);
825 - if (!o)
825 + if (!o) {
826 + packet_write_fmt(1,
827 + "ERR upload-pack: not our ref %s",
828 + sha1_to_hex(sha1_buf));
829 die("git upload-pack: not our ref %s",
830 sha1_to_hex(sha1_buf));
831 + }
832 if (!(o->flags & WANTED)) {
833 o->flags |= WANTED;
834 if (!((allow_unadvertised_object_request & ALLOW_ANY_SHA1) == ALLOW_ANY_SHA1