fetch-pack: use parse_oid_hex
Instead of hard-coding constants, use parse_oid_hex to compute a pointer and use it in further parsing operations. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
36261e42ec
commit
f6af19a9ad
12
fetch-pack.c
12
fetch-pack.c
|
@ -168,16 +168,16 @@ static enum ack_type get_ack(struct packet_reader *reader,
|
||||||
if (!strcmp(reader->line, "NAK"))
|
if (!strcmp(reader->line, "NAK"))
|
||||||
return NAK;
|
return NAK;
|
||||||
if (skip_prefix(reader->line, "ACK ", &arg)) {
|
if (skip_prefix(reader->line, "ACK ", &arg)) {
|
||||||
if (!get_oid_hex(arg, result_oid)) {
|
const char *p;
|
||||||
arg += 40;
|
if (!parse_oid_hex(arg, result_oid, &p)) {
|
||||||
len -= arg - reader->line;
|
len -= p - reader->line;
|
||||||
if (len < 1)
|
if (len < 1)
|
||||||
return ACK;
|
return ACK;
|
||||||
if (strstr(arg, "continue"))
|
if (strstr(p, "continue"))
|
||||||
return ACK_continue;
|
return ACK_continue;
|
||||||
if (strstr(arg, "common"))
|
if (strstr(p, "common"))
|
||||||
return ACK_common;
|
return ACK_common;
|
||||||
if (strstr(arg, "ready"))
|
if (strstr(p, "ready"))
|
||||||
return ACK_ready;
|
return ACK_ready;
|
||||||
return ACK;
|
return ACK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue