]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fetch-pack: use parse_oid_hex
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 18 Aug 2019 20:04:04 +0000 (20:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Aug 2019 22:04:57 +0000 (15:04 -0700)
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>
fetch-pack.c

index 65be043f2afafdb37b4ce4d6fe8fbd3ac0eb2eaf..1f56b8a6d780fd529f8ae188dbd68ef53b742ba0 100644 (file)
@@ -168,16 +168,16 @@ static enum ack_type get_ack(struct packet_reader *reader,
        if (!strcmp(reader->line, "NAK"))
                return NAK;
        if (skip_prefix(reader->line, "ACK ", &arg)) {
-               if (!get_oid_hex(arg, result_oid)) {
-                       arg += 40;
-                       len -= arg - reader->line;
+               const char *p;
+               if (!parse_oid_hex(arg, result_oid, &p)) {
+                       len -= p - reader->line;
                        if (len < 1)
                                return ACK;
-                       if (strstr(arg, "continue"))
+                       if (strstr(p, "continue"))
                                return ACK_continue;
-                       if (strstr(arg, "common"))
+                       if (strstr(p, "common"))
                                return ACK_common;
-                       if (strstr(arg, "ready"))
+                       if (strstr(p, "ready"))
                                return ACK_ready;
                        return ACK;
                }