diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2019-02-19 00:05:07 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-01 11:57:38 +0900 |
commit | 24dd363ed586f5edbdea96689d4e0e40a7d3f7fa (patch) | |
tree | 9cd737e581e3ab8cb235a9f71f85fb186f2c5342 /builtin/am.c | |
parent | fast-import: replace sha1_to_hex (diff) | |
download | tgif-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/am.c')
-rw-r--r-- | builtin/am.c | 9 |
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; } |