@@ -891,6 +891,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
891891 struct patch_ids ids ;
892892 char * add_signoff = NULL ;
893893 struct strbuf buf = STRBUF_INIT ;
894+ int use_patch_format = 0 ;
894895 const struct option builtin_format_patch_options [] = {
895896 { OPTION_CALLBACK , 'n' , "numbered" , & numbered , NULL ,
896897 "use [PATCH n/m] even with a single patch" ,
@@ -920,6 +921,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
920921 PARSE_OPT_NOARG | PARSE_OPT_NONEG , keep_callback },
921922 OPT_BOOLEAN (0 , "no-binary" , & no_binary_diff ,
922923 "don't output binary diffs" ),
924+ OPT_BOOLEAN ('p' , NULL , & use_patch_format ,
925+ "show patch format instead of default (patch + stat)" ),
923926 OPT_BOOLEAN (0 , "ignore-if-in-upstream" , & ignore_if_in_upstream ,
924927 "don't include a patch matching a commit upstream" ),
925928 OPT_GROUP ("Messaging" ),
@@ -1027,8 +1030,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
10271030 if (argc > 1 )
10281031 die ("unrecognized argument: %s" , argv [1 ]);
10291032
1030- if (!rev .diffopt .output_format
1031- || rev .diffopt .output_format == DIFF_FORMAT_PATCH )
1033+ if (use_patch_format )
1034+ rev .diffopt .output_format |= DIFF_FORMAT_PATCH ;
1035+ else if (!rev .diffopt .output_format ||
1036+ rev .diffopt .output_format == DIFF_FORMAT_PATCH )
10321037 rev .diffopt .output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH ;
10331038
10341039 if (!DIFF_OPT_TST (& rev .diffopt , TEXT ) && !no_binary_diff )
0 commit comments