diff options
author | Jim Meyering <jim@meyering.net> | 2009-05-09 10:12:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-05-09 08:10:15 -0700 |
commit | ca6b91d29b7ea937b71f62bf00ba7750f3e594ce (patch) | |
tree | bf7365b1d182c66926684c74eb0c0161588cde44 /builtin-log.c | |
parent | f01f1099f40f24fe6f7802185340a6fa3a3d4f35 (diff) | |
download | git-ca6b91d29b7ea937b71f62bf00ba7750f3e594ce.tar.gz |
format-patch let -k override a config-specified format.numbered
Let a command-line --keep-subject (-k) override a config-specified
format.numbered (--numbered (-n)), rather than provoking the
"-n and -k are mutually exclusive" failure.
* t4021-format-patch-numbered.sh: Test for the above
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-log.c')
-rw-r--r-- | builtin-log.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/builtin-log.c b/builtin-log.c index 5eaec5d24e..f10cfebdbb 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -755,6 +755,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) int cover_letter = 0; int boundary_count = 0; int no_binary_diff = 0; + int numbered_cmdline_opt = 0; struct commit *origin = NULL, *head = NULL; const char *in_reply_to = NULL; struct patch_ids ids; @@ -786,8 +787,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (!strcmp(argv[i], "--stdout")) use_stdout = 1; else if (!strcmp(argv[i], "-n") || - !strcmp(argv[i], "--numbered")) + !strcmp(argv[i], "--numbered")) { numbered = 1; + numbered_cmdline_opt = 1; + } else if (!strcmp(argv[i], "-N") || !strcmp(argv[i], "--no-numbered")) { numbered = 0; @@ -918,6 +921,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (start_number < 0) start_number = 1; + + /* + * If numbered is set solely due to format.numbered in config, + * and it would conflict with --keep-subject (-k) from the + * command line, reset "numbered". + */ + if (numbered && keep_subject && !numbered_cmdline_opt) + numbered = 0; + if (numbered && keep_subject) die ("-n and -k are mutually exclusive."); if (keep_subject && subject_prefix) |