path: root/sequencer.c
diff options
authorDoan Tran Cong Danh <>2019-11-18 11:57:47 (GMT)
committerJunio C Hamano <>2019-11-20 02:53:57 (GMT)
commite02058a72967b18bd906674de6191f42d03b0763 (patch)
treed5f2580ad5866c767ad05111f5ae096b054b8ee1 /sequencer.c
parentcd5522271f6b985114b33332e148bff2283b0440 (diff)
sequencer: handle rebase-merges for "onto" message
In order to work correctly, git-rebase --rebase-merges needs to make initial todo list with unique labels. Those unique labels is being handled by employing a hashmap and appending an unique number if any duplicate is found. But, we forget that beside those labels for side branches, we also have a special label `onto' for our so-called new-base. In a special case that any of those labels for side branches named `onto', git will run into trouble. Correct it. Signed-off-by: Doan Tran Cong Danh <> Acked-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sequencer.c')
1 files changed, 5 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index fece07b..9147d02 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4560,10 +4560,15 @@ static int make_script_with_merges(struct pretty_print_context *pp,
strbuf_init(&state.buf, 32);
if (revs-> && (revs->cmdline.rev[0].flags & BOTTOM)) {
+ struct labels_entry *onto_label_entry;
struct object_id *oid = &revs->cmdline.rev[0].item->oid;
FLEX_ALLOC_STR(entry, string, "onto");
oidcpy(&entry->entry.oid, oid);
oidmap_put(&state.commit2label, entry);
+ FLEX_ALLOC_STR(onto_label_entry, label, "onto");
+ hashmap_entry_init(&onto_label_entry->entry, strihash("onto"));
+ hashmap_add(&state.labels, &onto_label_entry->entry);