summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-07-16 01:28:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-07-16 21:27:39 (GMT)
commitfe04ccf7ca124d5ba980090868b173d873104f16 (patch)
tree6276c120d3aa91b4a0efa5679fb1d9b7c61a8920 /builtin
parent1928c9449e600e83de122b3fde7bb0664eee3fa5 (diff)
downloadgit-fe04ccf7ca124d5ba980090868b173d873104f16.zip
git-fe04ccf7ca124d5ba980090868b173d873104f16.tar.gz
git-fe04ccf7ca124d5ba980090868b173d873104f16.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/update-index.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 031cef5..3206c5a 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -827,6 +827,7 @@ static int parse_new_style_cacheinfo(const char *arg,
{
unsigned long ul;
char *endp;
+ const char *p;
if (!arg)
return -1;
@@ -837,9 +838,9 @@ static int parse_new_style_cacheinfo(const char *arg,
return -1; /* not a new-style cacheinfo */
*mode = ul;
endp++;
- if (get_oid_hex(endp, oid) || endp[GIT_SHA1_HEXSZ] != ',')
+ if (parse_oid_hex(endp, oid, &p) || *p != ',')
return -1;
- *path = endp + GIT_SHA1_HEXSZ + 1;
+ *path = p + 1;
return 0;
}