int root_with_onto = flags & TODO_LIST_ROOT_WITH_ONTO;
int skipped_commit = 0;
struct strbuf buf = STRBUF_INIT, oneline = STRBUF_INIT;
- struct strbuf label = STRBUF_INIT;
+ struct strbuf label_from_message = STRBUF_INIT;
struct commit_list *commits = NULL, **tail = &commits, *iter;
struct commit_list *tips = NULL, **tips_tail = &tips;
struct commit *commit;
oidmap_init(&state.commit2label, 0);
hashmap_init(&state.labels, labels_cmp, NULL, 0);
strbuf_init(&state.buf, 32);
+ load_branch_decorations();
if (revs->cmdline.nr && (revs->cmdline.rev[0].flags & BOTTOM)) {
struct labels_entry *onto_label_entry;
continue;
}
- /* Create a label */
- strbuf_reset(&label);
+ /* Create a label from the commit message */
+ strbuf_reset(&label_from_message);
if (skip_prefix(oneline.buf, "Merge ", &p1) &&
(p1 = strchr(p1, '\'')) &&
(p2 = strchr(++p1, '\'')))
- strbuf_add(&label, p1, p2 - p1);
+ strbuf_add(&label_from_message, p1, p2 - p1);
else if (skip_prefix(oneline.buf, "Merge pull request ",
&p1) &&
(p1 = strstr(p1, " from ")))
- strbuf_addstr(&label, p1 + strlen(" from "));
+ strbuf_addstr(&label_from_message, p1 + strlen(" from "));
else
- strbuf_addbuf(&label, &oneline);
+ strbuf_addbuf(&label_from_message, &oneline);
strbuf_reset(&buf);
strbuf_addf(&buf, "%s -C %s",
/* label the tips of merged branches */
for (; to_merge; to_merge = to_merge->next) {
+ const char *label = label_from_message.buf;
+ const struct name_decoration *decoration =
+ get_name_decoration(&to_merge->item->object);
+
+ if (decoration)
+ skip_prefix(decoration->name, "refs/heads/",
+ &label);
+
oid = &to_merge->item->object.oid;
strbuf_addch(&buf, ' ');
tips_tail = &commit_list_insert(to_merge->item,
tips_tail)->next;
- strbuf_addstr(&buf, label_oid(oid, label.buf, &state));
+ strbuf_addstr(&buf, label_oid(oid, label, &state));
}
strbuf_addf(&buf, " # %s", oneline.buf);
free_commit_list(commits);
free_commit_list(tips);
- strbuf_release(&label);
+ strbuf_release(&label_from_message);
strbuf_release(&oneline);
strbuf_release(&buf);
pick $(git log -1 --format=%h branch2~1) F
pick $(git log -1 --format=%h branch2) I
update-ref refs/heads/branch2
- label merge
+ label branch2
reset onto
pick $(git log -1 --format=%h refs/heads/second) J
update-ref refs/heads/second
update-ref refs/heads/third
pick $(git log -1 --format=%h HEAD~2) M
update-ref refs/heads/no-conflict-branch
- merge -C $(git log -1 --format=%h HEAD~1) merge # merge
+ merge -C $(git log -1 --format=%h HEAD~1) branch2 # merge
update-ref refs/heads/merge-branch
EOF