summaryrefslogtreecommitdiffstats
path: root/builtin/difftool.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2019-02-19 01:05:22 +0100
committerJunio C Hamano <gitster@pobox.com>2019-04-01 04:57:39 +0200
commitebe4df59c45ea95ce51fd8fede2a08d9009e990f (patch)
treeb7bd4ffa0399b6574c045cd406d3b84d55ad2804 /builtin/difftool.c
parentrefspec: make hash size independent (diff)
downloadgit-ebe4df59c45ea95ce51fd8fede2a08d9009e990f.tar.xz
git-ebe4df59c45ea95ce51fd8fede2a08d9009e990f.zip
builtin/difftool: use parse_oid_hex
Instead of using get_oid_hex and adding constants to the result, use parse_oid_hex to make this code independent of the hash size. Additionally, correct a typo that would cause us to print one too few characters on error, since we will already have incremented the pointer to point to the beginning of the object ID before we get to printing the error message. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/difftool.c')
-rw-r--r--builtin/difftool.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/builtin/difftool.c b/builtin/difftool.c
index a3ea60ea71..5fa83f481e 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -65,14 +65,12 @@ static int parse_index_info(char *p, int *mode1, int *mode2,
*mode2 = (int)strtol(p + 1, &p, 8);
if (*p != ' ')
return error("expected ' ', got '%c'", *p);
- if (get_oid_hex(++p, oid1))
- return error("expected object ID, got '%s'", p + 1);
- p += GIT_SHA1_HEXSZ;
+ if (parse_oid_hex(++p, oid1, (const char **)&p))
+ return error("expected object ID, got '%s'", p);
if (*p != ' ')
return error("expected ' ', got '%c'", *p);
- if (get_oid_hex(++p, oid2))
- return error("expected object ID, got '%s'", p + 1);
- p += GIT_SHA1_HEXSZ;
+ if (parse_oid_hex(++p, oid2, (const char **)&p))
+ return error("expected object ID, got '%s'", p);
if (*p != ' ')
return error("expected ' ', got '%c'", *p);
*status = *++p;