Skip to content

Commit fe04ccf

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1928c94 commit fe04ccf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

builtin/update-index.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ static int parse_new_style_cacheinfo(const char *arg,
827827
{
828828
unsigned long ul;
829829
char *endp;
830+
const char *p;
830831

831832
if (!arg)
832833
return -1;
@@ -837,9 +838,9 @@ static int parse_new_style_cacheinfo(const char *arg,
837838
return -1; /* not a new-style cacheinfo */
838839
*mode = ul;
839840
endp++;
840-
if (get_oid_hex(endp, oid) || endp[GIT_SHA1_HEXSZ] != ',')
841+
if (parse_oid_hex(endp, oid, &p) || *p != ',')
841842
return -1;
842-
*path = endp + GIT_SHA1_HEXSZ + 1;
843+
*path = p + 1;
843844
return 0;
844845
}
845846

0 commit comments

Comments
 (0)