Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
transport: use parse_oid_hex instead of a constant
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 15 Oct 2018 00:01:57 +0000
(
00:01
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 15 Oct 2018 03:53:15 +0000
(12:53 +0900)
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>
transport.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
f690b6b
)
diff --git
a/transport.c
b/transport.c
index 1c76d64aba9fac7d62dfc8e95ab2b32f45dd95a5..44b9ddf670531d8f27f8aaca9bee8ebadc2df6e7 100644
(file)
--- 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);