Merge branch 'dd/rebase-merge-reserves-onto-label'
The logic to avoid duplicate label names generated by "git rebase --rebase-merges" forgot that the machinery itself uses "onto" as a label name, which must be avoided by auto-generated labels, which has been corrected. * dd/rebase-merge-reserves-onto-label: sequencer: handle rebase-merges for "onto" message
This commit is contained in:
commit
995b1b1411
@ -4567,10 +4567,15 @@ static int make_script_with_merges(struct pretty_print_context *pp,
|
|||||||
strbuf_init(&state.buf, 32);
|
strbuf_init(&state.buf, 32);
|
||||||
|
|
||||||
if (revs->cmdline.nr && (revs->cmdline.rev[0].flags & BOTTOM)) {
|
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;
|
struct object_id *oid = &revs->cmdline.rev[0].item->oid;
|
||||||
FLEX_ALLOC_STR(entry, string, "onto");
|
FLEX_ALLOC_STR(entry, string, "onto");
|
||||||
oidcpy(&entry->entry.oid, oid);
|
oidcpy(&entry->entry.oid, oid);
|
||||||
oidmap_put(&state.commit2label, entry);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -474,4 +474,25 @@ test_expect_success '--rebase-merges with commit that can generate bad character
|
|||||||
git rebase --rebase-merges --force-rebase E
|
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
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user