aboutsummaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorKristoffer Haugsbakk <code@khaugsbakk.name>2024-11-25 21:13:11 +0100
committerJunio C Hamano <gitster@pobox.com>2024-11-26 10:05:08 +0900
commit94304b9f48e9c68f3214e25527c3aac865d3ce63 (patch)
tree4c960e79befed3096e33a70327a38c672bf1d924 /sequencer.c
parentfd3785337beb285ed7fd67ce6fc3d3bed2097b40 (diff)
downloadgit-94304b9f48e9c68f3214e25527c3aac865d3ce63.tar.xz
sequencer: comment checked-out branch properly
`git rebase --update-ref` does not insert commands for dependent/sub- branches which are checked out.[1] Instead it leaves a comment about that fact. The comment char is hardcoded (#). In turn the comment line gets interpreted as an invalid command when `core.commentChar`/ `core.commentString` is in use. † 1: See 900b50c242 (rebase: add --update-refs option, 2022-07-19) Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c
index 353d804999..1b6fd86f70 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -6382,8 +6382,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;