{"thread":{"id":"19768","subject":"[PATCH] Test cccmd in t9001-send-email.sh and fix two bugs","startedAt":"2009-06-10T17:34:03Z","lastAt":"2009-06-10T17:38:44Z","messageCount":2,"participants":["Paolo Bonzini"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"116019","messageId":"1244655243-12914-1-git-send-email-bonzini@gnu.org","threadId":"19768","inReplyTo":null,"subject":"[PATCH] Test cccmd in t9001-send-email.sh and fix two bugs","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-06-10T17:34:03Z","receivedAt":"2009-06-10T17:34:03Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"For another patch series I'm working on I needed some tests\nfor the cc-cmd feature of git-send-email.\n\nThis patch adds 3 tests for the feature, and fix two bugs.\nThe first bug is that the --suppress-cc option for `cccmd' was\nmisspelled as `ccmd' in the code.  The second bug, which is\nactually found only with my other series, is that the argument\nto the cccmd is never quoted, so the cccmd would fail with\npatch file names containing a space.\n\nI also test the possibility to specify --suppress-cc\nmultiple times.\n---\n git-send-email.perl   |    4 +-\n t/t9001-send-email.sh |   80 +++++++++++++++++++++++++++++++++++++++++++++---\n 2 files changed, 77 insertions(+), 7 deletions(-)\n\n\tThe patch is on top of maint, but it applies everywhere.\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex cccbf45..65a86d9 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -333,7 +333,7 @@ if (@suppress_cc) {\n }\n \n if ($suppress_cc{'all'}) {\n-\tforeach my $entry (qw (ccmd cc author self sob body bodycc)) {\n+\tforeach my $entry (qw (cccmd cc author self sob body bodyccc)) {\n \t\t$suppress_cc{$entry} = 1;\n \t}\n \tdelete $suppress_cc{'all'};\n@@ -1091,7 +1091,7 @@ foreach my $t (@files) {\n \tclose F;\n \n \tif (defined $cc_cmd && !$suppress_cc{'cccmd'}) {\n-\t\topen(F, \"$cc_cmd $t |\")\n+\t\topen(F, \"$cc_cmd \\Q$t\\E |\")\n \t\t\tor die \"(cc-cmd) Could not execute '$cc_cmd'\";\n \t\twhile(<F>) {\n \t\t\tmy $c = $_;\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex ce26ea4..00375f3 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -148,6 +148,22 @@ test_expect_success 'Prompting works' '\n \t\tgrep \"^To: to@example.com$\" msgtxt1\n '\n \n+test_expect_success 'cccmd works' '\n+\tclean_fake_sendmail &&\n+\tcp $patches cccmd.patch &&\n+\techo cccmd--cccmd@example.com >>cccmd.patch &&\n+\techo sed -n s/^cccmd--//p \\\"\\$1\\\" > cccmd-sed &&\n+\tchmod +x cccmd-sed &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--to=nobody@example.com \\\n+\t\t--cc-cmd=./cccmd-sed \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\tcccmd.patch \\\n+\t\t&&\n+\tgrep ^Cc:.*cccmd@example.com msgtxt1\n+'\n+\n z8=zzzzzzzz\n z64=$z8$z8$z8$z8$z8$z8$z8$z8\n z512=$z64$z64$z64$z64$z64$z64$z64$z64\n@@ -274,7 +290,7 @@ EOF\n test_suppression () {\n \tgit send-email \\\n \t\t--dry-run \\\n-\t\t--suppress-cc=$1 \\\n+\t\t--suppress-cc=$1 ${2+\"--suppress-cc=$2\"} \\\n \t\t--from=\"Example <from@example.com>\" \\\n \t\t--to=to@example.com \\\n \t\t--smtp-server relay.example.com \\\n@@ -282,8 +298,8 @@ test_suppression () {\n \tsed\t-e \"s/^\\(Date:\\).*/\\1 DATE-STRING/\" \\\n \t\t-e \"s/^\\(Message-Id:\\).*/\\1 MESSAGE-ID-STRING/\" \\\n \t\t-e \"s/^\\(X-Mailer:\\).*/\\1 X-MAILER-STRING/\" \\\n-\t\t>actual-suppress-$1 &&\n-\ttest_cmp expected-suppress-$1 actual-suppress-$1\n+\t\t>actual-suppress-$1${2+\"-$2\"} &&\n+\ttest_cmp expected-suppress-$1${2+\"-$2\"} actual-suppress-$1${2+\"-$2\"}\n }\n \n test_expect_success 'sendemail.cc set' '\n@@ -316,6 +332,34 @@ test_expect_success 'sendemail.cc unset' '\n \ttest_suppression sob\n '\n \n+cat >expected-suppress-cccmd <<\\EOF\n+0001-Second.patch\n+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n+(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'\n+Dry-OK. Log says:\n+Server: relay.example.com\n+MAIL FROM:<from@example.com>\n+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>\n+From: Example <from@example.com>\n+To: to@example.com\n+Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>\n+Subject: [PATCH 1/1] Second.\n+Date: DATE-STRING\n+Message-Id: MESSAGE-ID-STRING\n+X-Mailer: X-MAILER-STRING\n+\n+Result: OK\n+EOF\n+\n+test_expect_success 'sendemail.cccmd' '\n+\techo echo cc-cmd@example.com > cccmd &&\n+\tchmod +x cccmd &&\n+\tgit config sendemail.cccmd ./cccmd &&\n+\ttest_suppression cccmd\n+'\n+\n cat >expected-suppress-all <<\\EOF\n 0001-Second.patch\n Dry-OK. Log says:\n@@ -341,13 +385,14 @@ cat >expected-suppress-body <<\\EOF\n (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n+(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'\n Dry-OK. Log says:\n Server: relay.example.com\n MAIL FROM:<from@example.com>\n-RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>\n+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<cc-cmd@example.com>\n From: Example <from@example.com>\n To: to@example.com\n-Cc: A <author@example.com>, One <one@example.com>, two@example.com\n+Cc: A <author@example.com>, One <one@example.com>, two@example.com, cc-cmd@example.com\n Subject: [PATCH 1/1] Second.\n Date: DATE-STRING\n Message-Id: MESSAGE-ID-STRING\n@@ -360,6 +405,30 @@ test_expect_success '--suppress-cc=body' '\n \ttest_suppression body\n '\n \n+cat >expected-suppress-body-cccmd <<\\EOF\n+0001-Second.patch\n+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n+Dry-OK. Log says:\n+Server: relay.example.com\n+MAIL FROM:<from@example.com>\n+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>\n+From: Example <from@example.com>\n+To: to@example.com\n+Cc: A <author@example.com>, One <one@example.com>, two@example.com\n+Subject: [PATCH 1/1] Second.\n+Date: DATE-STRING\n+Message-Id: MESSAGE-ID-STRING\n+X-Mailer: X-MAILER-STRING\n+\n+Result: OK\n+EOF\n+\n+test_expect_success '--suppress-cc=body --suppress-cc=cccmd' '\n+\ttest_suppression body cccmd\n+'\n+\n cat >expected-suppress-sob <<\\EOF\n 0001-Second.patch\n (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n@@ -381,6 +450,7 @@ Result: OK\n EOF\n \n test_expect_success '--suppress-cc=sob' '\n+\tgit config --unset sendemail.cccmd\n \ttest_suppression sob\n '\n \n-- \n1.6.0.3\n"},{"id":"116021","messageId":"4A2FEFA4.1020708@gmail.com","threadId":"19768","inReplyTo":"1244655243-12914-1-git-send-email-bonzini@gnu.org","subject":"Re: [PATCH] Test cccmd in t9001-send-email.sh and fix two bugs","fromName":"Paolo Bonzini","fromEmail":"paolo.bonzini@gmail.com","sentAt":"2009-06-10T17:38:44Z","receivedAt":"2009-06-10T17:38:44Z","isPatch":true,"sender":{"key":"paolo.bonzini@gmail.com","avatar":"https://gravatar.com/avatar/7817ef2e168b4ef0570c5bb5bdc1d4b44f34d3075fe32b871710dd942d0a89f5?d=mp&s=160"},"body":"Signed-off-by:  Paolo Bonzini  <bonzini@gnu.org>\n\nOops.\n\nPaolo\n"}]}