send-pack: use skip_prefix for parsing unpack status
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>
Jeff King committed
Mar 7, 2017 at 08:36 UTC
f7cd74d19d3e2a194760024046534adf20f9efde
1 file changed
+3
-3
send-pack.c
+3
-3
@@ -133,10 +133,10 @@ static int pack_objects(int fd, struct ref *refs, struct sha1_array *extra, stru
133
static int receive_unpack_status(int in)
134
{
135
const char *line = packet_read_line(in, NULL);
136
- if (!starts_with(line, "unpack "))
136
+ if (!skip_prefix(line, "unpack ", &line))
137
return error("did not receive remote status");
138
- if (strcmp(line, "unpack ok"))
139
- return error("unpack failed: %s", line + 7);
138
+ if (strcmp(line, "ok"))
139
+ return error("unpack failed: %s", line);
140
return 0;
141
}
142