diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2018-10-15 02:01:57 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-15 05:53:15 +0200 |
commit | fbd0e37cde633221d5b3ca239f26cb7d005da5c8 (patch) | |
tree | 41f0b583a5b8f2c4a3d4f90b47565ebfd3be5a9e /transport.c | |
parent | upload-pack: express constants in terms of the_hash_algo (diff) | |
download | git-fbd0e37cde633221d5b3ca239f26cb7d005da5c8.tar.xz git-fbd0e37cde633221d5b3ca239f26cb7d005da5c8.zip |
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 <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 7 |
1 files changed, 4 insertions, 3 deletions
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); |