@@ -891,6 +891,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
891
891
struct patch_ids ids ;
892
892
char * add_signoff = NULL ;
893
893
struct strbuf buf = STRBUF_INIT ;
894
+ int use_patch_format = 0 ;
894
895
const struct option builtin_format_patch_options [] = {
895
896
{ OPTION_CALLBACK , 'n' , "numbered" , & numbered , NULL ,
896
897
"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)
920
921
PARSE_OPT_NOARG | PARSE_OPT_NONEG , keep_callback },
921
922
OPT_BOOLEAN (0 , "no-binary" , & no_binary_diff ,
922
923
"don't output binary diffs" ),
924
+ OPT_BOOLEAN ('p' , NULL , & use_patch_format ,
925
+ "show patch format instead of default (patch + stat)" ),
923
926
OPT_BOOLEAN (0 , "ignore-if-in-upstream" , & ignore_if_in_upstream ,
924
927
"don't include a patch matching a commit upstream" ),
925
928
OPT_GROUP ("Messaging" ),
@@ -1027,8 +1030,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
1027
1030
if (argc > 1 )
1028
1031
die ("unrecognized argument: %s" , argv [1 ]);
1029
1032
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 )
1032
1037
rev .diffopt .output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH ;
1033
1038
1034
1039
if (!DIFF_OPT_TST (& rev .diffopt , TEXT ) && !no_binary_diff )
0 commit comments