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>
This commit is contained in:
parent
f690b6b030
commit
fbd0e37cde
@ -1346,15 +1346,16 @@ static void read_alternate_refs(const char *path,
|
|||||||
fh = xfdopen(cmd.out, "r");
|
fh = xfdopen(cmd.out, "r");
|
||||||
while (strbuf_getline_lf(&line, fh) != EOF) {
|
while (strbuf_getline_lf(&line, fh) != EOF) {
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if (get_oid_hex(line.buf, &oid) ||
|
if (parse_oid_hex(line.buf, &oid, &p) ||
|
||||||
line.buf[GIT_SHA1_HEXSZ] != ' ') {
|
*p != ' ') {
|
||||||
warning(_("invalid line while parsing alternate refs: %s"),
|
warning(_("invalid line while parsing alternate refs: %s"),
|
||||||
line.buf);
|
line.buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cb(line.buf + GIT_SHA1_HEXSZ + 1, &oid, data);
|
cb(p + 1, &oid, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fh);
|
fclose(fh);
|
||||||
|
Loading…
Reference in New Issue
Block a user