summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <sandals@crustytoothpaste.net>2019-02-19 00:05:07 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-04-01 11:57:38 +0900
commit24dd363ed586f5edbdea96689d4e0e40a7d3f7fa (patch)
tree9cd737e581e3ab8cb235a9f71f85fb186f2c5342 /builtin
parentfast-import: replace sha1_to_hex (diff)
downloadtgif-24dd363ed586f5edbdea96689d4e0e40a7d3f7fa.tar.xz
builtin/am: make hash size independent
Instead of using GIT_SHA1_HEXSZ, switch to using the_hash_algo and parse_oid_hex to parse the lines involved in rebasing notes. 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/am.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 4fb107a9d1..5556a0651e 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -486,23 +486,24 @@ static int copy_notes_for_rebase(const struct am_state *state)
while (!strbuf_getline_lf(&sb, fp)) {
struct object_id from_obj, to_obj;
+ const char *p;
- if (sb.len != GIT_SHA1_HEXSZ * 2 + 1) {
+ if (sb.len != the_hash_algo->hexsz * 2 + 1) {
ret = error(invalid_line, sb.buf);
goto finish;
}
- if (get_oid_hex(sb.buf, &from_obj)) {
+ if (parse_oid_hex(sb.buf, &from_obj, &p)) {
ret = error(invalid_line, sb.buf);
goto finish;
}
- if (sb.buf[GIT_SHA1_HEXSZ] != ' ') {
+ if (*p != ' ') {
ret = error(invalid_line, sb.buf);
goto finish;
}
- if (get_oid_hex(sb.buf + GIT_SHA1_HEXSZ + 1, &to_obj)) {
+ if (get_oid_hex(p + 1, &to_obj)) {
ret = error(invalid_line, sb.buf);
goto finish;
}