@@ -755,6 +755,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
755
755
int cover_letter = 0 ;
756
756
int boundary_count = 0 ;
757
757
int no_binary_diff = 0 ;
758
+ int numbered_cmdline_opt = 0 ;
758
759
struct commit * origin = NULL , * head = NULL ;
759
760
const char * in_reply_to = NULL ;
760
761
struct patch_ids ids ;
@@ -786,8 +787,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
786
787
if (!strcmp (argv [i ], "--stdout" ))
787
788
use_stdout = 1 ;
788
789
else if (!strcmp (argv [i ], "-n" ) ||
789
- !strcmp (argv [i ], "--numbered" ))
790
+ !strcmp (argv [i ], "--numbered" )) {
790
791
numbered = 1 ;
792
+ numbered_cmdline_opt = 1 ;
793
+ }
791
794
else if (!strcmp (argv [i ], "-N" ) ||
792
795
!strcmp (argv [i ], "--no-numbered" )) {
793
796
numbered = 0 ;
@@ -918,6 +921,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
918
921
919
922
if (start_number < 0 )
920
923
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
+
921
933
if (numbered && keep_subject )
922
934
die ("-n and -k are mutually exclusive." );
923
935
if (keep_subject && subject_prefix )
0 commit comments