Skip to content

Commit f4c93e3

Browse files
committed
Merge branch 'dd/rebase-merge-reserves-onto-label' into jch
* dd/rebase-merge-reserves-onto-label: sequencer: handle rebase-merge for "onto" message
2 parents da8e83b + 16f96b6 commit f4c93e3

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

sequencer.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4574,10 +4574,15 @@ static int make_script_with_merges(struct pretty_print_context *pp,
45744574
strbuf_init(&state.buf, 32);
45754575

45764576
if (revs->cmdline.nr && (revs->cmdline.rev[0].flags & BOTTOM)) {
4577+
struct labels_entry *onto_label_entry;
45774578
struct object_id *oid = &revs->cmdline.rev[0].item->oid;
45784579
FLEX_ALLOC_STR(entry, string, "onto");
45794580
oidcpy(&entry->entry.oid, oid);
45804581
oidmap_put(&state.commit2label, entry);
4582+
4583+
FLEX_ALLOC_STR(onto_label_entry, label, "onto");
4584+
hashmap_entry_init(&onto_label_entry->entry, strihash("onto"));
4585+
hashmap_add(&state.labels, &onto_label_entry->entry);
45814586
}
45824587

45834588
/*

t/t3430-rebase-merges.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,4 +474,25 @@ test_expect_success '--rebase-merges with commit that can generate bad character
474474
git rebase --rebase-merges --force-rebase E
475475
'
476476

477+
test_expect_success '--rebase-merges with message matched with onto label' '
478+
git checkout -b onto-label E &&
479+
git merge -m onto G &&
480+
git rebase --rebase-merges --force-rebase E &&
481+
test_cmp_graph <<-\EOF
482+
* onto
483+
|\
484+
| * G
485+
| * F
486+
* | E
487+
|\ \
488+
| * | B
489+
* | | D
490+
| |/
491+
|/|
492+
* | C
493+
|/
494+
* A
495+
EOF
496+
'
497+
477498
test_done

0 commit comments

Comments
 (0)