diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:11 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-05-27 13:59:11 -0700 |
| commit | 80f49f2ae749bce60e79751d1cd0890aca86fca0 (patch) | |
| tree | a7089dbdb432ee7893b7cc80249b07773642898f /sequencer.c | |
| parent | f9cdaa2860e20f3f36595646b7a82082aa772df8 (diff) | |
| parent | e42667241de12840ef58c0ba1c060b86c850bae0 (diff) | |
| download | git-80f49f2ae749bce60e79751d1cd0890aca86fca0.tar.xz | |
Merge branch 'en/sequencer-comment-messages'
Prefix '#' to the commit title in the "rebase -i" todo file, just
like a merge commit being replayed.
* en/sequencer-comment-messages:
sequencer: make it clearer that commit descriptions are just comments
Diffstat (limited to 'sequencer.c')
| -rw-r--r-- | sequencer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c index da855e27ca..1ee0abbd45 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5902,11 +5902,11 @@ static int make_script_with_merges(struct pretty_print_context *pp, /* Create a label from the commit message */ strbuf_reset(&label_from_message); - if (skip_prefix(oneline.buf, "Merge ", &p1) && + if (skip_prefix(oneline.buf, "# Merge ", &p1) && (p1 = strchr(p1, '\'')) && (p2 = strchr(++p1, '\''))) strbuf_add(&label_from_message, p1, p2 - p1); - else if (skip_prefix(oneline.buf, "Merge pull request ", + else if (skip_prefix(oneline.buf, "# Merge pull request ", &p1) && (p1 = strstr(p1, " from "))) strbuf_addstr(&label_from_message, p1 + strlen(" from ")); @@ -5941,7 +5941,7 @@ static int make_script_with_merges(struct pretty_print_context *pp, strbuf_addstr(&buf, label_oid(oid, label, &state)); } - strbuf_addf(&buf, " # %s", oneline.buf); + strbuf_addf(&buf, " %s", oneline.buf); FLEX_ALLOC_STR(entry, string, buf.buf); oidcpy(&entry->entry.oid, &commit->object.oid); @@ -6023,7 +6023,7 @@ static int make_script_with_merges(struct pretty_print_context *pp, else { strbuf_reset(&oneline); pretty_print_commit(pp, commit, &oneline); - strbuf_addf(out, "%s %s # %s\n", + strbuf_addf(out, "%s %s %s\n", cmd_reset, to, oneline.buf); } } @@ -6091,8 +6091,14 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc, git_config_get_string("rebase.instructionFormat", &format); if (!format || !*format) { free(format); - format = xstrdup("%s"); + format = xstrdup("# %s"); } + if (*format != '#') { + char *temp = format; + format = xstrfmt("# %s", temp); + free(temp); + } + get_commit_format(format, &revs); free(format); pp.fmt = revs.commit_format; |
