summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f01f109)
raw | patch | inline | side by side (parent: f01f109)
author | Jim Meyering <jim@meyering.net> | |
Sat, 9 May 2009 08:12:01 +0000 (10:12 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 9 May 2009 15:10:15 +0000 (08:10 -0700) |
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>
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>
builtin-log.c | patch | blob | history | |
t/t4021-format-patch-numbered.sh | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 5eaec5d24e6ca70af2879ce9439eb2ba831211b6..f10cfebdbbabac67dea41639289e7ad968d5bbe3 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
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;
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;
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)
index 390af2389f3b9559fcfebe1e21a24317562ab7af..9b6e1be8b298f4675d77adeb84dc4c8dfb4d0c85 100755 (executable)
'
+test_expect_success 'format.numbered && --keep-subject' '
+
+ git format-patch --keep-subject --stdout HEAD^ >patch4a &&
+ grep "^Subject: Third" patch4a
+
+'
+
test_expect_success 'format.numbered = auto' '
git config format.numbered auto