[PATCH 27/31] builtin/difftool: use parse_oid_hex
To
git@vger.kernel.org
Cc
René Scharfe
Duy Nguyen
From
brian m. carlson
See Also
Prev
Date
2019-02-12 01:22:52 UTC
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.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 builtin/difftool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/builtin/difftool.c b/builtin/difftool.c
index a3ea60ea71..1b648226dc 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))
+	if (parse_oid_hex(++p, oid1, (const char **)&p))
 		return error("expected object ID, got '%s'", p + 1);
-	p += GIT_SHA1_HEXSZ;
 	if (*p != ' ')
 		return error("expected ' ', got '%c'", *p);
-	if (get_oid_hex(++p, oid2))
+	if (parse_oid_hex(++p, oid2, (const char **)&p))
 		return error("expected object ID, got '%s'", p + 1);
-	p += GIT_SHA1_HEXSZ;
 	if (*p != ' ')
 		return error("expected ' ', got '%c'", *p);
 	*status = *++p;