[PATCH 27/31] builtin/difftool: use parse_oid_hex
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Feb 12, 2019, 01:22 UTC
- Message-ID
- <20190212012256.1005924-28-sandals@crustytoothpaste.net>
- In-Reply-To
- <20190212012256.1005924-1-sandals@crustytoothpaste.net>
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;