@@ -755,6 +755,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
755755 int cover_letter = 0 ;
756756 int boundary_count = 0 ;
757757 int no_binary_diff = 0 ;
758+ int numbered_cmdline_opt = 0 ;
758759 struct commit * origin = NULL , * head = NULL ;
759760 const char * in_reply_to = NULL ;
760761 struct patch_ids ids ;
@@ -786,8 +787,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
786787 if (!strcmp (argv [i ], "--stdout" ))
787788 use_stdout = 1 ;
788789 else if (!strcmp (argv [i ], "-n" ) ||
789- !strcmp (argv [i ], "--numbered" ))
790+ !strcmp (argv [i ], "--numbered" )) {
790791 numbered = 1 ;
792+ numbered_cmdline_opt = 1 ;
793+ }
791794 else if (!strcmp (argv [i ], "-N" ) ||
792795 !strcmp (argv [i ], "--no-numbered" )) {
793796 numbered = 0 ;
@@ -918,6 +921,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
918921
919922 if (start_number < 0 )
920923 start_number = 1 ;
924+
925+ /*
926+ * If numbered is set solely due to format.numbered in config,
927+ * and it would conflict with --keep-subject (-k) from the
928+ * command line, reset "numbered".
929+ */
930+ if (numbered && keep_subject && !numbered_cmdline_opt )
931+ numbered = 0 ;
932+
921933 if (numbered && keep_subject )
922934 die ("-n and -k are mutually exclusive." );
923935 if (keep_subject && subject_prefix )
0 commit comments