Skip to content

Commit

Permalink
Merge branch 'dd/rebase-merge-reserves-onto-label' into jch
Browse files Browse the repository at this point in the history
* dd/rebase-merge-reserves-onto-label:
  sequencer: handle rebase-merge for "onto" message
  • Loading branch information
gitster committed Nov 19, 2019
2 parents da8e83b + 16f96b6 commit f4c93e3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sequencer.c
Original file line number Diff line number Diff line change
Expand Up @@ -4574,10 +4574,15 @@ static int make_script_with_merges(struct pretty_print_context *pp,
strbuf_init(&state.buf, 32);

if (revs->cmdline.nr && (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);
}

/*
Expand Down
21 changes: 21 additions & 0 deletions t/t3430-rebase-merges.sh
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,25 @@ test_expect_success '--rebase-merges with commit that can generate bad character
git rebase --rebase-merges --force-rebase E
'

test_expect_success '--rebase-merges with message matched with onto label' '
git checkout -b onto-label E &&
git merge -m onto G &&
git rebase --rebase-merges --force-rebase E &&
test_cmp_graph <<-\EOF
* onto
|\
| * G
| * F
* | E
|\ \
| * | B
* | | D
| |/
|/|
* | C
|/
* A
EOF
'

test_done

0 comments on commit f4c93e3

Please sign in to comment.