From: brian m. carlson Date: Mon, 15 Oct 2018 00:01:57 +0000 (+0000) Subject: transport: use parse_oid_hex instead of a constant X-Git-Tag: v2.20.0-rc0~122^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbd0e37cde633221d5b3ca239f26cb7d005da5c8;p=thirdparty%2Fgit.git transport: use parse_oid_hex instead of a constant Use parse_oid_hex to compute a pointer instead of using GIT_SHA1_HEXSZ. This simplifies the code and makes it independent of the hash length. Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- diff --git a/transport.c b/transport.c index 1c76d64aba..44b9ddf670 100644 --- a/transport.c +++ b/transport.c @@ -1346,15 +1346,16 @@ static void read_alternate_refs(const char *path, fh = xfdopen(cmd.out, "r"); while (strbuf_getline_lf(&line, fh) != EOF) { struct object_id oid; + const char *p; - if (get_oid_hex(line.buf, &oid) || - line.buf[GIT_SHA1_HEXSZ] != ' ') { + if (parse_oid_hex(line.buf, &oid, &p) || + *p != ' ') { warning(_("invalid line while parsing alternate refs: %s"), line.buf); break; } - cb(line.buf + GIT_SHA1_HEXSZ + 1, &oid, data); + cb(p + 1, &oid, data); } fclose(fh);