148
grep "^To: to@example.com$" msgtxt1
149
'
150
151
+test_expect_success 'cccmd works' '
152
+ clean_fake_sendmail &&
153
+ cp $patches cccmd.patch &&
154
+ echo cccmd--cccmd@example.com >>cccmd.patch &&
155
+ echo sed -n s/^cccmd--//p \"\$1\" > cccmd-sed &&
156
+ chmod +x cccmd-sed &&
157
+ git send-email \
158
+ --from="Example <nobody@example.com>" \
159
+ --to=nobody@example.com \
160
+ --cc-cmd=./cccmd-sed \
161
+ --smtp-server="$(pwd)/fake.sendmail" \
162
+ cccmd.patch \
163
+ &&
164
+ grep ^Cc:.*cccmd@example.com msgtxt1
165
+'
166
+
167
z8=zzzzzzzz
168
z64=$z8$z8$z8$z8$z8$z8$z8$z8
169
z512=$z64$z64$z64$z64$z64$z64$z64$z64
290
test_suppression () {
291
git send-email \
292
--dry-run \
277
- --suppress-cc=$1 \
293
+ --suppress-cc=$1 ${2+"--suppress-cc=$2"} \
294
--from="Example <from@example.com>" \
295
--to=to@example.com \
296
--smtp-server relay.example.com \
298
sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
299
-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
300
-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
285
- >actual-suppress-$1 &&
286
- test_cmp expected-suppress-$1 actual-suppress-$1
301
+ >actual-suppress-$1${2+"-$2"} &&
302
+ test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
303
}
304
305
test_expect_success 'sendemail.cc set' '
332
test_suppression sob
333
'
334
335
+cat >expected-suppress-cccmd <<\EOF
336
+0001-Second.patch
337
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
338
+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
339
+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
340
+(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
341
+Dry-OK. Log says:
342
+Server: relay.example.com
343
+MAIL FROM:<from@example.com>
344
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>
345
+From: Example <from@example.com>
346
+To: to@example.com
347
+Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>
348
+Subject: [PATCH 1/1] Second.
349
+Date: DATE-STRING
350
+Message-Id: MESSAGE-ID-STRING
351
+X-Mailer: X-MAILER-STRING
352
+
353
+Result: OK
354
+EOF
355
+
356
+test_expect_success 'sendemail.cccmd' '
357
+ echo echo cc-cmd@example.com > cccmd &&
358
+ chmod +x cccmd &&
359
+ git config sendemail.cccmd ./cccmd &&
360
+ test_suppression cccmd
361
+'
362
+
363
cat >expected-suppress-all <<\EOF
364
0001-Second.patch
365
Dry-OK. Log says:
385
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
386
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
387
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
388
+(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'
389
Dry-OK. Log says:
390
Server: relay.example.com
391
MAIL FROM:<from@example.com>
347
-RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
392
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<cc-cmd@example.com>
393
From: Example <from@example.com>
394
To: to@example.com
350
-Cc: A <author@example.com>, One <one@example.com>, two@example.com
395
+Cc: A <author@example.com>, One <one@example.com>, two@example.com, cc-cmd@example.com
396
Subject: [PATCH 1/1] Second.
397
Date: DATE-STRING
398
Message-Id: MESSAGE-ID-STRING
405
test_suppression body
406
'
407
408
+cat >expected-suppress-body-cccmd <<\EOF
409
+0001-Second.patch
410
+(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
411
+(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
412
+(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
413
+Dry-OK. Log says:
414
+Server: relay.example.com
415
+MAIL FROM:<from@example.com>
416
+RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
417
+From: Example <from@example.com>
418
+To: to@example.com
419
+Cc: A <author@example.com>, One <one@example.com>, two@example.com
420
+Subject: [PATCH 1/1] Second.
421
+Date: DATE-STRING
422
+Message-Id: MESSAGE-ID-STRING
423
+X-Mailer: X-MAILER-STRING
424
+
425
+Result: OK
426
+EOF
427
+
428
+test_expect_success '--suppress-cc=body --suppress-cc=cccmd' '
429
+ test_suppression body cccmd
430
+'
431
+
432
cat >expected-suppress-sob <<\EOF
433
0001-Second.patch
434
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
450
EOF
451
452
test_expect_success '--suppress-cc=sob' '
453
+ git config --unset sendemail.cccmd
454
test_suppression sob
455
'
456