upload-pack: report "not our ref" to client
authorJonathan Tan <jonathantanmy@google.com>
Thu, 23 Feb 2017 18:43:03 +0000 (10:43 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2017 20:14:40 +0000 (12:14 -0800)
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>
upload-pack.c
index 7597ba3405e161d59608e18ec580946c60f9e6d2..ffb028d6231e24877b5b6af616d0c3de59516d95 100644 (file)
@@ -822,9 +822,13 @@ static void receive_needs(void)
                        use_include_tag = 1;
 
                o = parse_object(sha1_buf);
-               if (!o)
+               if (!o) {
+                       packet_write_fmt(1,
+                                        "ERR upload-pack: not our ref %s",
+                                        sha1_to_hex(sha1_buf));
                        die("git upload-pack: not our ref %s",
                            sha1_to_hex(sha1_buf));
+               }
                if (!(o->flags & WANTED)) {
                        o->flags |= WANTED;
                        if (!((allow_unadvertised_object_request & ALLOW_ANY_SHA1) == ALLOW_ANY_SHA1