builtin/update-index: simplify parsing of cacheinfo
Switch from using get_oid_hex to parse_oid_hex to simplify pointer operations and avoid the need for a hash-related constant. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
1928c9449e
commit
fe04ccf7ca
@ -827,6 +827,7 @@ static int parse_new_style_cacheinfo(const char *arg,
|
|||||||
{
|
{
|
||||||
unsigned long ul;
|
unsigned long ul;
|
||||||
char *endp;
|
char *endp;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return -1;
|
return -1;
|
||||||
@ -837,9 +838,9 @@ static int parse_new_style_cacheinfo(const char *arg,
|
|||||||
return -1; /* not a new-style cacheinfo */
|
return -1; /* not a new-style cacheinfo */
|
||||||
*mode = ul;
|
*mode = ul;
|
||||||
endp++;
|
endp++;
|
||||||
if (get_oid_hex(endp, oid) || endp[GIT_SHA1_HEXSZ] != ',')
|
if (parse_oid_hex(endp, oid, &p) || *p != ',')
|
||||||
return -1;
|
return -1;
|
||||||
*path = endp + GIT_SHA1_HEXSZ + 1;
|
*path = p + 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user