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>
This commit is contained in:

committed by
Junio C Hamano

parent
7c39df2979
commit
f7cd74d19d
@ -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)
|
static int receive_unpack_status(int in)
|
||||||
{
|
{
|
||||||
const char *line = packet_read_line(in, NULL);
|
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");
|
return error("did not receive remote status");
|
||||||
if (strcmp(line, "unpack ok"))
|
if (strcmp(line, "ok"))
|
||||||
return error("unpack failed: %s", line + 7);
|
return error("unpack failed: %s", line);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user