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>
brian m. carlson committed
Jul 16, 2018 at 01:28 UTC
fe04ccf7ca124d5ba980090868b173d873104f16
1 file changed
+3
-2
builtin/update-index.c
+3
-2
@@ -827,6 +827,7 @@ static int parse_new_style_cacheinfo(const char *arg,
827
{
828
unsigned long ul;
829
char *endp;
830
+ const char *p;
831
832
if (!arg)
833
return -1;
@@ -837,9 +838,9 @@ static int parse_new_style_cacheinfo(const char *arg,
838
return -1; /* not a new-style cacheinfo */
839
*mode = ul;
840
endp++;
840
- if (get_oid_hex(endp, oid) || endp[GIT_SHA1_HEXSZ] != ',')
841
+ if (parse_oid_hex(endp, oid, &p) || *p != ',')
842
return -1;
842
- *path = endp + GIT_SHA1_HEXSZ + 1;
843
+ *path = p + 1;
844
return 0;
845
}
846