summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-10-15 00:01:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-15 03:53:15 (GMT)
commitfbd0e37cde633221d5b3ca239f26cb7d005da5c8 (patch)
tree41f0b583a5b8f2c4a3d4f90b47565ebfd3be5a9e
parentf690b6b03049e8f564aa0a1abbde5ec0731c5774 (diff)
downloadgit-fbd0e37cde633221d5b3ca239f26cb7d005da5c8.zip
git-fbd0e37cde633221d5b3ca239f26cb7d005da5c8.tar.gz
git-fbd0e37cde633221d5b3ca239f26cb7d005da5c8.tar.bz2
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>
-rw-r--r--transport.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/transport.c b/transport.c
index 1c76d64..44b9ddf 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);