diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2018-05-29 16:32:36 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-30 13:32:16 +0900 |
commit | 5971b0836eece0ffcafe15fd5d67934787ea1777 (patch) | |
tree | dcd12e4f818cc88061eef668cb7ce77665102785 /sequencer.c | |
parent | git-rebase--interactive: fix copy-paste mistake (diff) | |
download | tgif-5971b0836eece0ffcafe15fd5d67934787ea1777.tar.xz |
sequencer: ensure labels that are object IDs are rewritten
When writing the todo script for --rebase-merges, we try to find a label
for certain commits. If the label ends up being a valid object ID, such
as when we merge a detached commit, we want to rewrite it so it is no
longer a valid object ID.
However, the code path that does this checks for its length to be
equivalent to GIT_SHA1_RAWSZ, which isn't correct, since what we are
reading is a hex object ID. Instead, check for the length being
equivalent to that of a hex object ID. Use the_hash_algo so this code
works regardless of the hash size.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c index e2f8394284..017adbe8e1 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3534,7 +3534,7 @@ static const char *label_oid(struct object_id *oid, const char *label, p[i] = save; } } - } else if (((len = strlen(label)) == GIT_SHA1_RAWSZ && + } else if (((len = strlen(label)) == the_hash_algo->hexsz && !get_oid_hex(label, &dummy)) || (len == 1 && *label == '#') || hashmap_get_from_hash(&state->labels, |