@@ -627,7 +627,7 @@ static FILE *realstdout = NULL;
627627static const char * output_directory = NULL ;
628628static int outdir_offset ;
629629
630- static int reopen_stdout (struct commit * commit , struct rev_info * rev )
630+ static int reopen_stdout (struct commit * commit , struct rev_info * rev , int quiet )
631631{
632632 struct strbuf filename = STRBUF_INIT ;
633633 int suffix_len = strlen (fmt_patch_suffix ) + 1 ;
@@ -643,7 +643,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
643643
644644 get_patch_filename (commit , rev -> nr , fmt_patch_suffix , & filename );
645645
646- if (!DIFF_OPT_TST ( & rev -> diffopt , QUICK ) )
646+ if (!quiet )
647647 fprintf (realstdout , "%s\n" , filename .buf + outdir_offset );
648648
649649 if (freopen (filename .buf , "w" , stdout ) == NULL )
@@ -722,7 +722,8 @@ static void print_signature(void)
722722static void make_cover_letter (struct rev_info * rev , int use_stdout ,
723723 int numbered , int numbered_files ,
724724 struct commit * origin ,
725- int nr , struct commit * * list , struct commit * head )
725+ int nr , struct commit * * list , struct commit * head ,
726+ int quiet )
726727{
727728 const char * committer ;
728729 const char * subject_start = NULL ;
@@ -758,7 +759,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
758759 sha1_to_hex (head -> object .sha1 ), committer , committer );
759760 }
760761
761- if (!use_stdout && reopen_stdout (commit , rev ))
762+ if (!use_stdout && reopen_stdout (commit , rev , quiet ))
762763 return ;
763764
764765 if (commit ) {
@@ -999,6 +1000,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
9991000 char * add_signoff = NULL ;
10001001 struct strbuf buf = STRBUF_INIT ;
10011002 int use_patch_format = 0 ;
1003+ int quiet = 0 ;
10021004 const struct option builtin_format_patch_options [] = {
10031005 { OPTION_CALLBACK , 'n' , "numbered" , & numbered , NULL ,
10041006 "use [PATCH n/m] even with a single patch" ,
@@ -1054,6 +1056,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
10541056 PARSE_OPT_OPTARG , thread_callback },
10551057 OPT_STRING (0 , "signature" , & signature , "signature" ,
10561058 "add a signature" ),
1059+ OPT_BOOLEAN (0 , "quiet" , & quiet ,
1060+ "don't print the patch filenames" ),
10571061 OPT_END ()
10581062 };
10591063
@@ -1263,7 +1267,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
12631267 if (thread )
12641268 gen_message_id (& rev , "cover" );
12651269 make_cover_letter (& rev , use_stdout , numbered , numbered_files ,
1266- origin , nr , list , head );
1270+ origin , nr , list , head , quiet );
12671271 total ++ ;
12681272 start_number -- ;
12691273 }
@@ -1309,7 +1313,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
13091313 }
13101314
13111315 if (!use_stdout && reopen_stdout (numbered_files ? NULL : commit ,
1312- & rev ))
1316+ & rev , quiet ))
13131317 die (_ ("Failed to create output files" ));
13141318 shown = log_tree_commit (& rev , commit );
13151319 free (commit -> buffer );
0 commit comments