diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-12-06 13:23:17 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-06 13:23:18 +0900 |
| commit | 0f588c466151392b6df3c1a730f468a6c79e05de (patch) | |
| tree | e755a22235acc0bd649c7f72d4535f72a6b7a1fa /sequencer.c | |
| parent | b4269ebf3591b51bd0463057b97e1786123b74d1 (diff) | |
| parent | 7e2f377b03b0d3593df73a094f97c27b219b02f5 (diff) | |
| download | git-0f588c466151392b6df3c1a730f468a6c79e05de.tar.xz | |
Merge branch 'kh/sequencer-comment-char'
The sequencer failed to honor core.commentString in some places.
* kh/sequencer-comment-char:
sequencer: comment commit messages properly
sequencer: comment `--reference` subject line properly
sequencer: comment checked-out branch properly
Diffstat (limited to 'sequencer.c')
| -rw-r--r-- | sequencer.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/sequencer.c b/sequencer.c index 287f4e5e87..459066e43b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1941,10 +1941,10 @@ static int seen_squash(struct replay_ctx *ctx) static void update_comment_bufs(struct strbuf *buf1, struct strbuf *buf2, int n) { - strbuf_setlen(buf1, 2); + strbuf_setlen(buf1, strlen(comment_line_str) + 1); strbuf_addf(buf1, _(nth_commit_msg_fmt), n); strbuf_addch(buf1, '\n'); - strbuf_setlen(buf2, 2); + strbuf_setlen(buf2, strlen(comment_line_str) + 1); strbuf_addf(buf2, _(skip_nth_commit_msg_fmt), n); strbuf_addch(buf2, '\n'); } @@ -1963,8 +1963,12 @@ static void update_squash_message_for_fixup(struct strbuf *msg) size_t orig_msg_len; int i = 1; - strbuf_addf(&buf1, "# %s\n", _(first_commit_msg_str)); - strbuf_addf(&buf2, "# %s\n", _(skip_first_commit_msg_str)); + strbuf_add_commented_lines(&buf1, _(first_commit_msg_str), + strlen(_(first_commit_msg_str)), + comment_line_str); + strbuf_add_commented_lines(&buf2, _(skip_first_commit_msg_str), + strlen(_(skip_first_commit_msg_str)), + comment_line_str); s = start = orig_msg = strbuf_detach(msg, &orig_msg_len); while (s) { const char *next; @@ -2341,8 +2345,8 @@ static int do_pick_commit(struct repository *r, next = parent; next_label = msg.parent_label; if (opts->commit_use_reference) { - strbuf_addstr(&ctx->message, - "# *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***"); + strbuf_commented_addf(&ctx->message, comment_line_str, + "*** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***"); } else if (skip_prefix(msg.subject, "Revert \"", &orig_subject) && /* * We don't touch pre-existing repeated reverts, because @@ -2352,12 +2356,13 @@ static int do_pick_commit(struct repository *r, !starts_with(orig_subject, "Revert \"")) { strbuf_addstr(&ctx->message, "Reapply \""); strbuf_addstr(&ctx->message, orig_subject); + strbuf_addstr(&ctx->message, "\n"); } else { strbuf_addstr(&ctx->message, "Revert \""); strbuf_addstr(&ctx->message, msg.subject); - strbuf_addstr(&ctx->message, "\""); + strbuf_addstr(&ctx->message, "\"\n"); } - strbuf_addstr(&ctx->message, "\n\nThis reverts commit "); + strbuf_addstr(&ctx->message, "\nThis reverts commit "); refer_to_commit(opts, &ctx->message, commit); if (commit->parents && commit->parents->next) { @@ -6382,8 +6387,9 @@ static int add_decorations_to_list(const struct commit *commit, /* If the branch is checked out, then leave a comment instead. */ if ((path = branch_checked_out(decoration->name))) { item->command = TODO_COMMENT; - strbuf_addf(ctx->buf, "# Ref %s checked out at '%s'\n", - decoration->name, path); + strbuf_commented_addf(ctx->buf, comment_line_str, + "Ref %s checked out at '%s'\n", + decoration->name, path); } else { struct string_list_item *sti; item->command = TODO_UPDATE_REF; |
