{"thread":{"id":"28253","subject":"[PATCH 2/4] t4014: invoke format-patch with --stdout where intended","startedAt":"2011-08-29T20:10:46Z","lastAt":"2011-08-29T22:30:17Z","messageCount":5,"participants":["Thomas Rast","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"174486","messageId":"bbfb7190ca0125798417f57f4d33b5443257e478.1314648438.git.trast@student.ethz.ch","threadId":"28253","inReplyTo":null,"subject":"[PATCH 1/4] t4014: check for empty files from git format-patch --stdout","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2011-08-29T20:10:46Z","receivedAt":"2011-08-29T20:10:46Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Most kinds of failure in 'git format-patch --stdout >output' will\nresult in an empty 'output'.  This slips past checks that only verify\nabsence of output, such as the '! grep ...' that are quite prevalent\nin t4014.\n\nIntroduce a helper check_patch() that checks that at least From, Date\nand Subject are present, thus making sure it looks vaguely like a\npatch (or cover letter) email.  Then insert calls to it in all tests\nthat do have positive checks for content.\n\nThis makes two of the tests fail.  Mark them as such; they'll be\nfixed in a moment.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nI noticed \"fatal: unrecognized argument: --no-add-headers\" in the\nslow-moving 'make valgrind' output, and unearthed some more\nproblems...  The other three patches are a corollary of this.\n\n t/t4014-format-patch.sh |   21 +++++++++++++++++++--\n 1 files changed, 19 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 92248d2..b4d4207 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -179,12 +179,21 @@ test_expect_success 'configuration To: header' '\n \tgrep \"^To: R. E. Cipient <rcipient@example.com>\\$\" patch9\n '\n \n+# check_patch <patch>: Verify that <patch> looks like a half-sane\n+# patch email to avoid a false positive with !grep\n+check_patch () {\n+\tgrep -e \"^From:\" \"$1\" &&\n+\tgrep -e \"^Date:\" \"$1\" &&\n+\tgrep -e \"^Subject:\" \"$1\"\n+}\n+\n test_expect_success '--no-to overrides config.to' '\n \n \tgit config --replace-all format.to \\\n \t\t\"R. E. Cipient <rcipient@example.com>\" &&\n \tgit format-patch --no-to --stdout master..side |\n \tsed -e \"/^\\$/q\" >patch10 &&\n+\tcheck_patch patch10 &&\n \t! grep \"^To: R. E. Cipient <rcipient@example.com>\\$\" patch10\n '\n \n@@ -195,6 +204,7 @@ test_expect_success '--no-to and --to replaces config.to' '\n \tgit format-patch --no-to --to=\"Someone Else <else@out.there>\" \\\n \t\t--stdout master..side |\n \tsed -e \"/^\\$/q\" >patch11 &&\n+\tcheck_patch patch11 &&\n \t! grep \"^To: Someone <someone@out.there>\\$\" patch11 &&\n \tgrep \"^To: Someone Else <else@out.there>\\$\" patch11\n '\n@@ -205,15 +215,17 @@ test_expect_success '--no-cc overrides config.cc' '\n \t\t\"C. E. Cipient <rcipient@example.com>\" &&\n \tgit format-patch --no-cc --stdout master..side |\n \tsed -e \"/^\\$/q\" >patch12 &&\n+\tcheck_patch patch12 &&\n \t! grep \"^Cc: C. E. Cipient <rcipient@example.com>\\$\" patch12\n '\n \n-test_expect_success '--no-add-headers overrides config.headers' '\n+test_expect_failure '--no-add-headers overrides config.headers' '\n \n \tgit config --replace-all format.headers \\\n \t\t\"Header1: B. E. Cipient <rcipient@example.com>\" &&\n \tgit format-patch --no-add-headers --stdout master..side |\n \tsed -e \"/^\\$/q\" >patch13 &&\n+\tcheck_patch patch13 &&\n \t! grep \"^Header1: B. E. Cipient <rcipient@example.com>\\$\" patch13\n '\n \n@@ -480,6 +492,7 @@ test_expect_success 'cover-letter inherits diff options' '\n \tgit mv file foo &&\n \tgit commit -m foo &&\n \tgit format-patch --cover-letter -1 &&\n+\tcheck_patch 0000-cover-letter.patch &&\n \t! grep \"file => foo .* 0 *\\$\" 0000-cover-letter.patch &&\n \tgit format-patch --cover-letter -1 -M &&\n \tgrep \"file => foo .* 0 *\\$\" 0000-cover-letter.patch\n@@ -657,6 +670,7 @@ test_expect_success 'format-patch --no-signature ignores format.signature' '\n \tgit config format.signature \"config sig\" &&\n \tgit format-patch --stdout --signature=\"my sig\" --no-signature \\\n \t\t-1 >output &&\n+\tcheck_patch output &&\n \t! grep \"config sig\" output &&\n \t! grep \"my sig\" output &&\n \t! grep \"^-- \\$\" output\n@@ -673,17 +687,20 @@ test_expect_success 'format-patch --signature --cover-letter' '\n test_expect_success 'format.signature=\"\" supresses signatures' '\n \tgit config format.signature \"\" &&\n \tgit format-patch --stdout -1 >output &&\n+\tcheck_patch output &&\n \t! grep \"^-- \\$\" output\n '\n \n test_expect_success 'format-patch --no-signature supresses signatures' '\n \tgit config --unset-all format.signature &&\n \tgit format-patch --stdout --no-signature -1 >output &&\n+\tcheck_patch output &&\n \t! grep \"^-- \\$\" output\n '\n \n-test_expect_success 'format-patch --signature=\"\" supresses signatures' '\n+test_expect_failure 'format-patch --signature=\"\" supresses signatures' '\n \tgit format-patch --signature=\"\" -1 >output &&\n+\tcheck_patch output &&\n \t! grep \"^-- \\$\" output\n '\n \n-- \n1.7.7.rc0.370.gdcae57\n"},{"id":"174485","messageId":"797b96d784211a9d26eac1a5f5f7f0388a2c6a3b.1314648438.git.trast@student.ethz.ch","threadId":"28253","inReplyTo":"bbfb7190ca0125798417f57f4d33b5443257e478.1314648438.git.trast@student.ethz.ch","subject":"[PATCH 2/4] t4014: invoke format-patch with --stdout where intended","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2011-08-29T20:10:47Z","receivedAt":"2011-08-29T20:10:47Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The test wrote something along the lines of 0001-foo.patch to output,\nwhich of course never contained a signature.  Luckily the tested\nbehaviour is actually present.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n t/t4014-format-patch.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex b4d4207..a45d4fb 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -698,8 +698,8 @@ test_expect_success 'format-patch --no-signature supresses signatures' '\n \t! grep \"^-- \\$\" output\n '\n \n-test_expect_failure 'format-patch --signature=\"\" supresses signatures' '\n-\tgit format-patch --signature=\"\" -1 >output &&\n+test_expect_success 'format-patch --signature=\"\" supresses signatures' '\n+\tgit format-patch --stdout --signature=\"\" -1 >output &&\n \tcheck_patch output &&\n \t! grep \"^-- \\$\" output\n '\n-- \n1.7.7.rc0.370.gdcae57\n"},{"id":"174487","messageId":"221564762d013a422c36f42401c5782a7b20aa17.1314648438.git.trast@student.ethz.ch","threadId":"28253","inReplyTo":"bbfb7190ca0125798417f57f4d33b5443257e478.1314648438.git.trast@student.ethz.ch","subject":"[PATCH 3/4] t4014: \"no-add-headers\" is actually called \"no-add-header\"","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2011-08-29T20:10:48Z","receivedAt":"2011-08-29T20:10:48Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Since c426003 (format-patch: add --no-cc, --no-to, and\n--no-add-headers, 2010-03-07) the tests have checked for an option\ncalled --no-add-headers introduced by letting the user negate\n--add-header.\n\nHowever, the parseopt machinery does not automatically pluralize\nanything, so it is in fact called --no-add-header.\n\nSince the option never worked, is not documented anywhere, and\nimplementing an actual --no-add-headers would lead to silly code\ncomplications, we just adapt the test to the code.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n t/t4014-format-patch.sh |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex a45d4fb..5cbc066 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -219,11 +219,11 @@ test_expect_success '--no-cc overrides config.cc' '\n \t! grep \"^Cc: C. E. Cipient <rcipient@example.com>\\$\" patch12\n '\n \n-test_expect_failure '--no-add-headers overrides config.headers' '\n+test_expect_success '--no-add-header overrides config.headers' '\n \n \tgit config --replace-all format.headers \\\n \t\t\"Header1: B. E. Cipient <rcipient@example.com>\" &&\n-\tgit format-patch --no-add-headers --stdout master..side |\n+\tgit format-patch --no-add-header --stdout master..side |\n \tsed -e \"/^\\$/q\" >patch13 &&\n \tcheck_patch patch13 &&\n \t! grep \"^Header1: B. E. Cipient <rcipient@example.com>\\$\" patch13\n-- \n1.7.7.rc0.370.gdcae57\n"},{"id":"174488","messageId":"b18a36a42a45dd4147c43d959c64e00b9b17e4ac.1314648438.git.trast@student.ethz.ch","threadId":"28253","inReplyTo":"bbfb7190ca0125798417f57f4d33b5443257e478.1314648438.git.trast@student.ethz.ch","subject":"[PATCH 4/4] Document negated forms of format-patch --to --cc --add-headers","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2011-08-29T20:10:49Z","receivedAt":"2011-08-29T20:10:49Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"The negated forms introduced in c426003 (format-patch: add --no-cc,\n--no-to, and --no-add-headers, 2010-03-07) were not documented\nanywhere.  Add them to the descriptions of the positive forms.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nI can't help but notice that the options aren't symmetric:\n--no-add-header clears more than just the options added by\n--add-header.  It's probably too late to change though.\n\n\n Documentation/git-format-patch.txt |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex d13c9b2..6ea9be7 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -166,15 +166,22 @@ will want to ensure that threading is disabled for `git send-email`.\n --to=<email>::\n \tAdd a `To:` header to the email headers. This is in addition\n \tto any configured headers, and may be used multiple times.\n+\tThe negated form `--no-to` discards all `To:` headers added so\n+\tfar (from config or command line).\n \n --cc=<email>::\n \tAdd a `Cc:` header to the email headers. This is in addition\n \tto any configured headers, and may be used multiple times.\n+\tThe negated form `--no-cc` discards all `Cc:` headers added so\n+\tfar (from config or command line).\n \n --add-header=<header>::\n \tAdd an arbitrary header to the email headers.  This is in addition\n \tto any configured headers, and may be used multiple times.\n-\tFor example, `--add-header=\"Organization: git-foo\"`\n+\tFor example, `--add-header=\"Organization: git-foo\"`.\n+\tThe negated form `--no-add-header` discards *all* (`To:`,\n+\t`Cc:`, and custom) headers added so far from config or command\n+\tline.\n \n --cover-letter::\n \tIn addition to the patches, generate a cover letter file\n-- \n1.7.7.rc0.370.gdcae57\n"},{"id":"174516","messageId":"7vsjoj4zra.fsf@alter.siamese.dyndns.org","threadId":"28253","inReplyTo":"bbfb7190ca0125798417f57f4d33b5443257e478.1314648438.git.trast@student.ethz.ch","subject":"Re: [PATCH 1/4] t4014: check for empty files from git format-patch --stdout","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-29T22:30:17Z","receivedAt":"2011-08-29T22:30:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}