@@ -1941,10 +1941,10 @@ static int seen_squash(struct replay_ctx *ctx)
19411941
19421942static void update_comment_bufs (struct strbuf * buf1 , struct strbuf * buf2 , int n )
19431943{
1944- strbuf_setlen (buf1 , 2 );
1944+ strbuf_setlen (buf1 , strlen ( comment_line_str ) + 1 );
19451945 strbuf_addf (buf1 , _ (nth_commit_msg_fmt ), n );
19461946 strbuf_addch (buf1 , '\n' );
1947- strbuf_setlen (buf2 , 2 );
1947+ strbuf_setlen (buf2 , strlen ( comment_line_str ) + 1 );
19481948 strbuf_addf (buf2 , _ (skip_nth_commit_msg_fmt ), n );
19491949 strbuf_addch (buf2 , '\n' );
19501950}
@@ -1963,8 +1963,12 @@ static void update_squash_message_for_fixup(struct strbuf *msg)
19631963 size_t orig_msg_len ;
19641964 int i = 1 ;
19651965
1966- strbuf_addf (& buf1 , "# %s\n" , _ (first_commit_msg_str ));
1967- strbuf_addf (& buf2 , "# %s\n" , _ (skip_first_commit_msg_str ));
1966+ strbuf_add_commented_lines (& buf1 , _ (first_commit_msg_str ),
1967+ strlen (_ (first_commit_msg_str )),
1968+ comment_line_str );
1969+ strbuf_add_commented_lines (& buf2 , _ (skip_first_commit_msg_str ),
1970+ strlen (_ (skip_first_commit_msg_str )),
1971+ comment_line_str );
19681972 s = start = orig_msg = strbuf_detach (msg , & orig_msg_len );
19691973 while (s ) {
19701974 const char * next ;
@@ -2341,8 +2345,8 @@ static int do_pick_commit(struct repository *r,
23412345 next = parent ;
23422346 next_label = msg .parent_label ;
23432347 if (opts -> commit_use_reference ) {
2344- strbuf_addstr (& ctx -> message ,
2345- "# *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***" );
2348+ strbuf_commented_addf (& ctx -> message , comment_line_str ,
2349+ "*** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***" );
23462350 } else if (skip_prefix (msg .subject , "Revert \"" , & orig_subject ) &&
23472351 /*
23482352 * We don't touch pre-existing repeated reverts, because
@@ -2352,12 +2356,13 @@ static int do_pick_commit(struct repository *r,
23522356 !starts_with (orig_subject , "Revert \"" )) {
23532357 strbuf_addstr (& ctx -> message , "Reapply \"" );
23542358 strbuf_addstr (& ctx -> message , orig_subject );
2359+ strbuf_addstr (& ctx -> message , "\n" );
23552360 } else {
23562361 strbuf_addstr (& ctx -> message , "Revert \"" );
23572362 strbuf_addstr (& ctx -> message , msg .subject );
2358- strbuf_addstr (& ctx -> message , "\"" );
2363+ strbuf_addstr (& ctx -> message , "\"\n " );
23592364 }
2360- strbuf_addstr (& ctx -> message , "\n\ nThis reverts commit " );
2365+ strbuf_addstr (& ctx -> message , "\nThis reverts commit " );
23612366 refer_to_commit (opts , & ctx -> message , commit );
23622367
23632368 if (commit -> parents && commit -> parents -> next ) {
@@ -6382,8 +6387,9 @@ static int add_decorations_to_list(const struct commit *commit,
63826387 /* If the branch is checked out, then leave a comment instead. */
63836388 if ((path = branch_checked_out (decoration -> name ))) {
63846389 item -> command = TODO_COMMENT ;
6385- strbuf_addf (ctx -> buf , "# Ref %s checked out at '%s'\n" ,
6386- decoration -> name , path );
6390+ strbuf_commented_addf (ctx -> buf , comment_line_str ,
6391+ "Ref %s checked out at '%s'\n" ,
6392+ decoration -> name , path );
63876393 } else {
63886394 struct string_list_item * sti ;
63896395 item -> command = TODO_UPDATE_REF ;
0 commit comments