send-pack: use skip_prefix for parsing unpack status
authorJeff King <peff@peff.net>
Tue, 7 Mar 2017 13:36:19 +0000 (08:36 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Mar 2017 22:54:14 +0000 (14:54 -0800)
This avoids repeating ourselves, and the use of magic
numbers.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
send-pack.c
index 12e229e4476f7efe268070e543a2ccd8de9ab7e8..243633da17784cdb14ae056b0b9015f9e439d76c 100644 (file)
@@ -133,10 +133,10 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
 static int receive_unpack_status(int in)
 {
        const char *line = packet_read_line(in, NULL);
-       if (!starts_with(line, "unpack "))
+       if (!skip_prefix(line, "unpack ", &line))
                return error("did not receive remote status");
-       if (strcmp(line, "unpack ok"))
-               return error("unpack failed: %s", line + 7);
+       if (strcmp(line, "ok"))
+               return error("unpack failed: %s", line);
        return 0;
 }