@@ -335,22 +335,25 @@ static void clear_image(struct image *image)
335335 image -> len = 0 ;
336336}
337337
338- static void say_patch_name ( FILE * output , const char * pre ,
339- struct patch * patch , const char * post )
338+ /* fmt must contain _one_ %s and no other substitution */
339+ static void say_patch_name ( FILE * output , const char * fmt , struct patch * patch )
340340{
341- fputs (pre , output );
341+ struct strbuf sb = STRBUF_INIT ;
342+
342343 if (patch -> old_name && patch -> new_name &&
343344 strcmp (patch -> old_name , patch -> new_name )) {
344- quote_c_style (patch -> old_name , NULL , output , 0 );
345- fputs ( " => " , output );
346- quote_c_style (patch -> new_name , NULL , output , 0 );
345+ quote_c_style (patch -> old_name , & sb , NULL , 0 );
346+ strbuf_addstr ( & sb , " => " );
347+ quote_c_style (patch -> new_name , & sb , NULL , 0 );
347348 } else {
348349 const char * n = patch -> new_name ;
349350 if (!n )
350351 n = patch -> old_name ;
351- quote_c_style (n , NULL , output , 0 );
352+ quote_c_style (n , & sb , NULL , 0 );
352353 }
353- fputs (post , output );
354+ fprintf (output , fmt , sb .buf );
355+ fputc ('\n' , output );
356+ strbuf_release (& sb );
354357}
355358
356359#define CHUNKSIZE (8192)
@@ -3172,7 +3175,7 @@ static int check_patch_list(struct patch *patch)
31723175 while (patch ) {
31733176 if (apply_verbosely )
31743177 say_patch_name (stderr ,
3175- "Checking patch " , patch , " ...\n" );
3178+ _ ( "Checking patch %s ..." ), patch );
31763179 err |= check_patch (patch );
31773180 patch = patch -> next ;
31783181 }
@@ -3536,6 +3539,7 @@ static int write_out_one_reject(struct patch *patch)
35363539 char namebuf [PATH_MAX ];
35373540 struct fragment * frag ;
35383541 int cnt = 0 ;
3542+ struct strbuf sb = STRBUF_INIT ;
35393543
35403544 for (cnt = 0 , frag = patch -> fragments ; frag ; frag = frag -> next ) {
35413545 if (!frag -> rejected )
@@ -3546,7 +3550,7 @@ static int write_out_one_reject(struct patch *patch)
35463550 if (!cnt ) {
35473551 if (apply_verbosely )
35483552 say_patch_name (stderr ,
3549- "Applied patch " , patch , " cleanly.\n" );
3553+ _ ( "Applied patch %s cleanly." ), patch );
35503554 return 0 ;
35513555 }
35523556
@@ -3557,8 +3561,12 @@ static int write_out_one_reject(struct patch *patch)
35573561 die (_ ("internal error" ));
35583562
35593563 /* Say this even without --verbose */
3560- say_patch_name (stderr , "Applying patch " , patch , " with" );
3561- fprintf (stderr , " %d rejects...\n" , cnt );
3564+ strbuf_addf (& sb , Q_ ("Applying patch %%s with %d reject..." ,
3565+ "Applying patch %%s with %d rejects..." ,
3566+ cnt ),
3567+ cnt );
3568+ say_patch_name (stderr , sb .buf , patch );
3569+ strbuf_release (& sb );
35623570
35633571 cnt = strlen (patch -> new_name );
35643572 if (ARRAY_SIZE (namebuf ) <= cnt + 5 ) {
0 commit comments