From: Junio C Hamano Date: Thu, 3 Dec 2009 21:54:25 +0000 (-0800) Subject: Merge branch 'fc/maint-format-patch-pathspec-dashes' into maint X-Git-Tag: v1.6.5.5~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c8b1d761f61c4be0b036620ba418ff0e97979fde?ds=inline;hp=-c Merge branch 'fc/maint-format-patch-pathspec-dashes' into maint * fc/maint-format-patch-pathspec-dashes: format-patch: add test for parsing of "--" format-patch: fix parsing of "--" on the command line --- c8b1d761f61c4be0b036620ba418ff0e97979fde diff --combined builtin-log.c index 7b91c91423,cac98afddb..0cf978e094 --- a/builtin-log.c +++ b/builtin-log.c @@@ -891,7 -891,6 +891,7 @@@ int cmd_format_patch(int argc, const ch struct patch_ids ids; char *add_signoff = NULL; struct strbuf buf = STRBUF_INIT; + int use_patch_format = 0; const struct option builtin_format_patch_options[] = { { OPTION_CALLBACK, 'n', "numbered", &numbered, NULL, "use [PATCH n/m] even with a single patch", @@@ -921,8 -920,6 +921,8 @@@ PARSE_OPT_NOARG | PARSE_OPT_NONEG, keep_callback }, OPT_BOOLEAN(0, "no-binary", &no_binary_diff, "don't output binary diffs"), + OPT_BOOLEAN('p', NULL, &use_patch_format, + "show patch format instead of default (patch + stat)"), OPT_BOOLEAN(0, "ignore-if-in-upstream", &ignore_if_in_upstream, "don't include a patch matching a commit upstream"), OPT_GROUP("Messaging"), @@@ -969,7 -966,8 +969,8 @@@ */ argc = parse_options(argc, argv, prefix, builtin_format_patch_options, builtin_format_patch_usage, - PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN); + PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | + PARSE_OPT_KEEP_DASHDASH); if (do_signoff) { const char *committer; @@@ -1030,10 -1028,8 +1031,10 @@@ if (argc > 1) die ("unrecognized argument: %s", argv[1]); - if (!rev.diffopt.output_format - || rev.diffopt.output_format == DIFF_FORMAT_PATCH) + if (use_patch_format) + rev.diffopt.output_format |= DIFF_FORMAT_PATCH; + else if (!rev.diffopt.output_format || + rev.diffopt.output_format == DIFF_FORMAT_PATCH) rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH; if (!DIFF_OPT_TST(&rev.diffopt, TEXT) && !no_binary_diff) diff --combined t/t4014-format-patch.sh index cab6ce2e97,437807e41e..74e5b63bbf --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@@ -455,27 -455,6 +455,27 @@@ test_expect_success 'format-patch respe ' +cat > expect << EOF + +diff --git a/file b/file +index 40f36c6..2dc5c23 100644 +--- a/file ++++ b/file +@@ -14,3 +14,19 @@ C + D + E + F ++5 +EOF + +test_expect_success 'format-patch -p suppresses stat' ' + + git format-patch -p -2 && + sed -e "1,/^$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output && + test_cmp expect output + +' + test_expect_success 'format-patch from a subdirectory (1)' ' filename=$( rm -rf sub && @@@ -536,4 -515,9 +536,9 @@@ test_expect_success 'format-patch --sig grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" ' + test_expect_success 'format-patch -- ' ' + git format-patch master..side -- file 2>error && + ! grep "Use .--" error + ' + test_done