From: Jeff King Date: Tue, 7 Mar 2017 13:36:19 +0000 (-0500) Subject: send-pack: use skip_prefix for parsing unpack status X-Git-Tag: v2.12.2~8^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f7cd74d19d3e2a194760024046534adf20f9efde?ds=inline;hp=--cc send-pack: use skip_prefix for parsing unpack status This avoids repeating ourselves, and the use of magic numbers. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- f7cd74d19d3e2a194760024046534adf20f9efde diff --git a/send-pack.c b/send-pack.c index 12e229e447..243633da17 100644 --- a/send-pack.c +++ b/send-pack.c @@ -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; }