@@ -1941,10 +1941,10 @@ static int seen_squash(struct replay_ctx *ctx)
1941
1941
1942
1942
static void update_comment_bufs (struct strbuf * buf1 , struct strbuf * buf2 , int n )
1943
1943
{
1944
- strbuf_setlen (buf1 , 2 );
1944
+ strbuf_setlen (buf1 , strlen ( comment_line_str ) + 1 );
1945
1945
strbuf_addf (buf1 , _ (nth_commit_msg_fmt ), n );
1946
1946
strbuf_addch (buf1 , '\n' );
1947
- strbuf_setlen (buf2 , 2 );
1947
+ strbuf_setlen (buf2 , strlen ( comment_line_str ) + 1 );
1948
1948
strbuf_addf (buf2 , _ (skip_nth_commit_msg_fmt ), n );
1949
1949
strbuf_addch (buf2 , '\n' );
1950
1950
}
@@ -1963,8 +1963,12 @@ static void update_squash_message_for_fixup(struct strbuf *msg)
1963
1963
size_t orig_msg_len ;
1964
1964
int i = 1 ;
1965
1965
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 );
1968
1972
s = start = orig_msg = strbuf_detach (msg , & orig_msg_len );
1969
1973
while (s ) {
1970
1974
const char * next ;
@@ -2341,8 +2345,8 @@ static int do_pick_commit(struct repository *r,
2341
2345
next = parent ;
2342
2346
next_label = msg .parent_label ;
2343
2347
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 ***" );
2346
2350
} else if (skip_prefix (msg .subject , "Revert \"" , & orig_subject ) &&
2347
2351
/*
2348
2352
* We don't touch pre-existing repeated reverts, because
@@ -2352,12 +2356,13 @@ static int do_pick_commit(struct repository *r,
2352
2356
!starts_with (orig_subject , "Revert \"" )) {
2353
2357
strbuf_addstr (& ctx -> message , "Reapply \"" );
2354
2358
strbuf_addstr (& ctx -> message , orig_subject );
2359
+ strbuf_addstr (& ctx -> message , "\n" );
2355
2360
} else {
2356
2361
strbuf_addstr (& ctx -> message , "Revert \"" );
2357
2362
strbuf_addstr (& ctx -> message , msg .subject );
2358
- strbuf_addstr (& ctx -> message , "\"" );
2363
+ strbuf_addstr (& ctx -> message , "\"\n " );
2359
2364
}
2360
- strbuf_addstr (& ctx -> message , "\n\ nThis reverts commit " );
2365
+ strbuf_addstr (& ctx -> message , "\nThis reverts commit " );
2361
2366
refer_to_commit (opts , & ctx -> message , commit );
2362
2367
2363
2368
if (commit -> parents && commit -> parents -> next ) {
@@ -6382,8 +6387,9 @@ static int add_decorations_to_list(const struct commit *commit,
6382
6387
/* If the branch is checked out, then leave a comment instead. */
6383
6388
if ((path = branch_checked_out (decoration -> name ))) {
6384
6389
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 );
6387
6393
} else {
6388
6394
struct string_list_item * sti ;
6389
6395
item -> command = TODO_UPDATE_REF ;
0 commit comments