1#!/bin/sh
2
3test_description='git send-email'
4. ./test-lib.sh
5
6# May be altered later in the test
7PREREQ="PERL"
8
9test_expect_success $PREREQ \
10 'prepare reference tree' \
11 'echo "1A quick brown fox jumps over the" >file &&
12 echo "lazy dog" >>file &&
13 git add file &&
14 GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
15
16test_expect_success $PREREQ \
17 'Setup helper tool' \
18 '(echo "#!$SHELL_PATH"
19 echo shift
20 echo output=1
21 echo "while test -f commandline\$output; do output=\$((\$output+1)); done"
22 echo for a
23 echo do
24 echo " echo \"!\$a!\""
25 echo "done >commandline\$output"
26 test_have_prereq MINGW && echo "dos2unix commandline\$output"
27 echo "cat > msgtxt\$output"
28 ) >fake.sendmail &&
29 chmod +x ./fake.sendmail &&
30 git add fake.sendmail &&
31 GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
32
33clean_fake_sendmail() {
34 rm -f commandline* msgtxt*
35}
36
37test_expect_success $PREREQ 'Extract patches' '
38 patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
39'
40
41# Test no confirm early to ensure remaining tests will not hang
42test_no_confirm () {
43 rm -f no_confirm_okay
44 echo n | \
45 GIT_SEND_EMAIL_NOTTY=1 \
46 git send-email \
47 --from="Example <from@example.com>" \
48 --to=nobody@example.com \
49 --smtp-server="$(pwd)/fake.sendmail" \
50 $@ \
51 $patches > stdout &&
52 test_must_fail grep "Send this email" stdout &&
53 > no_confirm_okay
54}
55
56# Exit immediately to prevent hang if a no-confirm test fails
57check_no_confirm () {
58 if ! test -f no_confirm_okay
59 then
60 say 'confirm test failed; skipping remaining tests to prevent hanging'
61 PREREQ="$PREREQ,CHECK_NO_CONFIRM"
62 fi
63 return 0
64}
65
66test_expect_success $PREREQ 'No confirm with --suppress-cc' '
67 test_no_confirm --suppress-cc=sob &&
68 check_no_confirm
69'
70
71
72test_expect_success $PREREQ 'No confirm with --confirm=never' '
73 test_no_confirm --confirm=never &&
74 check_no_confirm
75'
76
77# leave sendemail.confirm set to never after this so that none of the
78# remaining tests prompt unintentionally.
79test_expect_success $PREREQ 'No confirm with sendemail.confirm=never' '
80 git config sendemail.confirm never &&
81 test_no_confirm --compose --subject=foo &&
82 check_no_confirm
83'
84
85test_expect_success $PREREQ 'Send patches' '
86 git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
87'
88
89test_expect_success $PREREQ 'setup expect' '
90cat >expected <<\EOF
91!nobody@example.com!
92!author@example.com!
93!one@example.com!
94!two@example.com!
95EOF
96'
97
98test_expect_success $PREREQ \
99 'Verify commandline' \
100 'test_cmp expected commandline1'
101
102test_expect_success $PREREQ 'Send patches with --envelope-sender' '
103 clean_fake_sendmail &&
104 git send-email --envelope-sender="Patch Contributer <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
105'
106
107test_expect_success $PREREQ 'setup expect' '
108cat >expected <<\EOF
109!patch@example.com!
110!-i!
111!nobody@example.com!
112!author@example.com!
113!one@example.com!
114!two@example.com!
115EOF
116'
117
118test_expect_success $PREREQ \
119 'Verify commandline' \
120 'test_cmp expected commandline1'
121
122test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
123 clean_fake_sendmail &&
124 git send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
125'
126
127test_expect_success $PREREQ 'setup expect' '
128cat >expected <<\EOF
129!nobody@example.com!
130!-i!
131!nobody@example.com!
132!author@example.com!
133!one@example.com!
134!two@example.com!
135EOF
136'
137
138test_expect_success $PREREQ \
139 'Verify commandline' \
140 'test_cmp expected commandline1'
141
142test_expect_success $PREREQ 'setup expect' "
143cat >expected-show-all-headers <<\EOF
1440001-Second.patch
145(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
146(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
147(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
148Dry-OK. Log says:
149Server: relay.example.com
150MAIL FROM:<from@example.com>
151RCPT TO:<to@example.com>
152RCPT TO:<cc@example.com>
153RCPT TO:<author@example.com>
154RCPT TO:<one@example.com>
155RCPT TO:<two@example.com>
156RCPT TO:<bcc@example.com>
157From: Example <from@example.com>
158To: to@example.com
159Cc: cc@example.com,
160 A <author@example.com>,
161 One <one@example.com>,
162 two@example.com
163Subject: [PATCH 1/1] Second.
164Date: DATE-STRING
165Message-Id: MESSAGE-ID-STRING
166X-Mailer: X-MAILER-STRING
167In-Reply-To: <unique-message-id@example.com>
168References: <unique-message-id@example.com>
169
170Result: OK
171EOF
172"
173
174test_expect_success $PREREQ 'Show all headers' '
175 git send-email \
176 --dry-run \
177 --suppress-cc=sob \
178 --from="Example <from@example.com>" \
179 --to=to@example.com \
180 --cc=cc@example.com \
181 --bcc=bcc@example.com \
182 --in-reply-to="<unique-message-id@example.com>" \
183 --smtp-server relay.example.com \
184 $patches |
185 sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
186 -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
187 -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
188 >actual-show-all-headers &&
189 test_cmp expected-show-all-headers actual-show-all-headers
190'
191
192test_expect_success $PREREQ 'Prompting works' '
193 clean_fake_sendmail &&
194 (echo "Example <from@example.com>"
195 echo "to@example.com"
196 echo ""
197 ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
198 --smtp-server="$(pwd)/fake.sendmail" \
199 $patches \
200 2>errors &&
201 grep "^From: Example <from@example.com>\$" msgtxt1 &&
202 grep "^To: to@example.com\$" msgtxt1
203'
204
205test_expect_success $PREREQ 'tocmd works' '
206 clean_fake_sendmail &&
207 cp $patches tocmd.patch &&
208 echo tocmd--tocmd@example.com >>tocmd.patch &&
209 {
210 echo "#!$SHELL_PATH"
211 echo sed -n -e s/^tocmd--//p \"\$1\"
212 } > tocmd-sed &&
213 chmod +x tocmd-sed &&
214 git send-email \
215 --from="Example <nobody@example.com>" \
216 --to-cmd=./tocmd-sed \
217 --smtp-server="$(pwd)/fake.sendmail" \
218 tocmd.patch \
219 &&
220 grep "^To: tocmd@example.com" msgtxt1
221'
222
223test_expect_success $PREREQ 'cccmd works' '
224 clean_fake_sendmail &&
225 cp $patches cccmd.patch &&
226 echo "cccmd-- cccmd@example.com" >>cccmd.patch &&
227 {
228 echo "#!$SHELL_PATH"
229 echo sed -n -e s/^cccmd--//p \"\$1\"
230 } > cccmd-sed &&
231 chmod +x cccmd-sed &&
232 git send-email \
233 --from="Example <nobody@example.com>" \
234 --to=nobody@example.com \
235 --cc-cmd=./cccmd-sed \
236 --smtp-server="$(pwd)/fake.sendmail" \
237 cccmd.patch \
238 &&
239 grep "^ cccmd@example.com" msgtxt1
240'
241
242test_expect_success $PREREQ 'reject long lines' '
243 z8=zzzzzzzz &&
244 z64=$z8$z8$z8$z8$z8$z8$z8$z8 &&
245 z512=$z64$z64$z64$z64$z64$z64$z64$z64 &&
246 clean_fake_sendmail &&
247 cp $patches longline.patch &&
248 echo $z512$z512 >>longline.patch &&
249 test_must_fail git send-email \
250 --from="Example <nobody@example.com>" \
251 --to=nobody@example.com \
252 --smtp-server="$(pwd)/fake.sendmail" \
253 $patches longline.patch \
254 2>errors &&
255 grep longline.patch errors
256'
257
258test_expect_success $PREREQ 'no patch was sent' '
259 ! test -e commandline1
260'
261
262test_expect_success $PREREQ 'Author From: in message body' '
263 clean_fake_sendmail &&
264 git send-email \
265 --from="Example <nobody@example.com>" \
266 --to=nobody@example.com \
267 --smtp-server="$(pwd)/fake.sendmail" \
268 $patches &&
269 sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
270 grep "From: A <author@example.com>" msgbody1
271'
272
273test_expect_success $PREREQ 'Author From: not in message body' '
274 clean_fake_sendmail &&
275 git send-email \
276 --from="A <author@example.com>" \
277 --to=nobody@example.com \
278 --smtp-server="$(pwd)/fake.sendmail" \
279 $patches &&
280 sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
281 ! grep "From: A <author@example.com>" msgbody1
282'
283
284test_expect_success $PREREQ 'allow long lines with --no-validate' '
285 git send-email \
286 --from="Example <nobody@example.com>" \
287 --to=nobody@example.com \
288 --smtp-server="$(pwd)/fake.sendmail" \
289 --novalidate \
290 $patches longline.patch \
291 2>errors
292'
293
294test_expect_success $PREREQ 'Invalid In-Reply-To' '
295 clean_fake_sendmail &&
296 git send-email \
297 --from="Example <nobody@example.com>" \
298 --to=nobody@example.com \
299 --in-reply-to=" " \
300 --smtp-server="$(pwd)/fake.sendmail" \
301 $patches \
302 2>errors &&
303 ! grep "^In-Reply-To: < *>" msgtxt1
304'
305
306test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
307 clean_fake_sendmail &&
308 (echo "From Example <from@example.com>"
309 echo "To Example <to@example.com>"
310 echo ""
311 ) | env GIT_SEND_EMAIL_NOTTY=1 git send-email \
312 --smtp-server="$(pwd)/fake.sendmail" \
313 $patches 2>errors &&
314 ! grep "^In-Reply-To: < *>" msgtxt1
315'
316
317test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
318 clean_fake_sendmail &&
319 echo "<unique-message-id@example.com>" >expect &&
320 git send-email \
321 --from="Example <nobody@example.com>" \
322 --to=nobody@example.com \
323 --nochain-reply-to \
324 --in-reply-to="$(cat expect)" \
325 --smtp-server="$(pwd)/fake.sendmail" \
326 $patches $patches $patches \
327 2>errors &&
328 # The first message is a reply to --in-reply-to
329 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
330 test_cmp expect actual &&
331 # Second and subsequent messages are replies to the first one
332 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
333 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
334 test_cmp expect actual &&
335 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
336 test_cmp expect actual
337'
338
339test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
340 clean_fake_sendmail &&
341 echo "<unique-message-id@example.com>" >expect &&
342 git send-email \
343 --from="Example <nobody@example.com>" \
344 --to=nobody@example.com \
345 --chain-reply-to \
346 --in-reply-to="$(cat expect)" \
347 --smtp-server="$(pwd)/fake.sendmail" \
348 $patches $patches $patches \
349 2>errors &&
350 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
351 test_cmp expect actual &&
352 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
353 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
354 test_cmp expect actual &&
355 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
356 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
357 test_cmp expect actual
358'
359
360test_expect_success $PREREQ 'setup fake editor' '
361 (echo "#!$SHELL_PATH" &&
362 echo "echo fake edit >>\"\$1\""
363 ) >fake-editor &&
364 chmod +x fake-editor
365'
366
367test_set_editor "$(pwd)/fake-editor"
368
369test_expect_success $PREREQ '--compose works' '
370 clean_fake_sendmail &&
371 git send-email \
372 --compose --subject foo \
373 --from="Example <nobody@example.com>" \
374 --to=nobody@example.com \
375 --smtp-server="$(pwd)/fake.sendmail" \
376 $patches \
377 2>errors
378'
379
380test_expect_success $PREREQ 'first message is compose text' '
381 grep "^fake edit" msgtxt1
382'
383
384test_expect_success $PREREQ 'second message is patch' '
385 grep "Subject:.*Second" msgtxt2
386'
387
388test_expect_success $PREREQ 'setup expect' "
389cat >expected-suppress-sob <<\EOF
3900001-Second.patch
391(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
392(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
393(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
394Dry-OK. Log says:
395Server: relay.example.com
396MAIL FROM:<from@example.com>
397RCPT TO:<to@example.com>
398RCPT TO:<cc@example.com>
399RCPT TO:<author@example.com>
400RCPT TO:<one@example.com>
401RCPT TO:<two@example.com>
402From: Example <from@example.com>
403To: to@example.com
404Cc: cc@example.com,
405 A <author@example.com>,
406 One <one@example.com>,
407 two@example.com
408Subject: [PATCH 1/1] Second.
409Date: DATE-STRING
410Message-Id: MESSAGE-ID-STRING
411X-Mailer: X-MAILER-STRING
412
413Result: OK
414EOF
415"
416
417test_suppression () {
418 git send-email \
419 --dry-run \
420 --suppress-cc=$1 ${2+"--suppress-cc=$2"} \
421 --from="Example <from@example.com>" \
422 --to=to@example.com \
423 --smtp-server relay.example.com \
424 $patches |
425 sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
426 -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
427 -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
428 >actual-suppress-$1${2+"-$2"} &&
429 test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
430}
431
432test_expect_success $PREREQ 'sendemail.cc set' '
433 git config sendemail.cc cc@example.com &&
434 test_suppression sob
435'
436
437test_expect_success $PREREQ 'setup expect' "
438cat >expected-suppress-sob <<\EOF
4390001-Second.patch
440(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
441(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
442(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
443Dry-OK. Log says:
444Server: relay.example.com
445MAIL FROM:<from@example.com>
446RCPT TO:<to@example.com>
447RCPT TO:<author@example.com>
448RCPT TO:<one@example.com>
449RCPT TO:<two@example.com>
450From: Example <from@example.com>
451To: to@example.com
452Cc: A <author@example.com>,
453 One <one@example.com>,
454 two@example.com
455Subject: [PATCH 1/1] Second.
456Date: DATE-STRING
457Message-Id: MESSAGE-ID-STRING
458X-Mailer: X-MAILER-STRING
459
460Result: OK
461EOF
462"
463
464test_expect_success $PREREQ 'sendemail.cc unset' '
465 git config --unset sendemail.cc &&
466 test_suppression sob
467'
468
469test_expect_success $PREREQ 'setup expect' "
470cat >expected-suppress-cccmd <<\EOF
4710001-Second.patch
472(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
473(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
474(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
475(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
476Dry-OK. Log says:
477Server: relay.example.com
478MAIL FROM:<from@example.com>
479RCPT TO:<to@example.com>
480RCPT TO:<author@example.com>
481RCPT TO:<one@example.com>
482RCPT TO:<two@example.com>
483RCPT TO:<committer@example.com>
484From: Example <from@example.com>
485To: to@example.com
486Cc: A <author@example.com>,
487 One <one@example.com>,
488 two@example.com,
489 C O Mitter <committer@example.com>
490Subject: [PATCH 1/1] Second.
491Date: DATE-STRING
492Message-Id: MESSAGE-ID-STRING
493X-Mailer: X-MAILER-STRING
494
495Result: OK
496EOF
497"
498
499test_expect_success $PREREQ 'sendemail.cccmd' '
500 echo echo cc-cmd@example.com > cccmd &&
501 chmod +x cccmd &&
502 git config sendemail.cccmd ./cccmd &&
503 test_suppression cccmd
504'
505
506test_expect_success $PREREQ 'setup expect' '
507cat >expected-suppress-all <<\EOF
5080001-Second.patch
509Dry-OK. Log says:
510Server: relay.example.com
511MAIL FROM:<from@example.com>
512RCPT TO:<to@example.com>
513From: Example <from@example.com>
514To: to@example.com
515Subject: [PATCH 1/1] Second.
516Date: DATE-STRING
517Message-Id: MESSAGE-ID-STRING
518X-Mailer: X-MAILER-STRING
519
520Result: OK
521EOF
522'
523
524test_expect_success $PREREQ '--suppress-cc=all' '
525 test_suppression all
526'
527
528test_expect_success $PREREQ 'setup expect' "
529cat >expected-suppress-body <<\EOF
5300001-Second.patch
531(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
532(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
533(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
534(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'
535Dry-OK. Log says:
536Server: relay.example.com
537MAIL FROM:<from@example.com>
538RCPT TO:<to@example.com>
539RCPT TO:<author@example.com>
540RCPT TO:<one@example.com>
541RCPT TO:<two@example.com>
542RCPT TO:<cc-cmd@example.com>
543From: Example <from@example.com>
544To: to@example.com
545Cc: A <author@example.com>,
546 One <one@example.com>,
547 two@example.com,
548 cc-cmd@example.com
549Subject: [PATCH 1/1] Second.
550Date: DATE-STRING
551Message-Id: MESSAGE-ID-STRING
552X-Mailer: X-MAILER-STRING
553
554Result: OK
555EOF
556"
557
558test_expect_success $PREREQ '--suppress-cc=body' '
559 test_suppression body
560'
561
562test_expect_success $PREREQ 'setup expect' "
563cat >expected-suppress-body-cccmd <<\EOF
5640001-Second.patch
565(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
566(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
567(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
568Dry-OK. Log says:
569Server: relay.example.com
570MAIL FROM:<from@example.com>
571RCPT TO:<to@example.com>
572RCPT TO:<author@example.com>
573RCPT TO:<one@example.com>
574RCPT TO:<two@example.com>
575From: Example <from@example.com>
576To: to@example.com
577Cc: A <author@example.com>,
578 One <one@example.com>,
579 two@example.com
580Subject: [PATCH 1/1] Second.
581Date: DATE-STRING
582Message-Id: MESSAGE-ID-STRING
583X-Mailer: X-MAILER-STRING
584
585Result: OK
586EOF
587"
588
589test_expect_success $PREREQ '--suppress-cc=body --suppress-cc=cccmd' '
590 test_suppression body cccmd
591'
592
593test_expect_success $PREREQ 'setup expect' "
594cat >expected-suppress-sob <<\EOF
5950001-Second.patch
596(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
597(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
598(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
599Dry-OK. Log says:
600Server: relay.example.com
601MAIL FROM:<from@example.com>
602RCPT TO:<to@example.com>
603RCPT TO:<author@example.com>
604RCPT TO:<one@example.com>
605RCPT TO:<two@example.com>
606From: Example <from@example.com>
607To: to@example.com
608Cc: A <author@example.com>,
609 One <one@example.com>,
610 two@example.com
611Subject: [PATCH 1/1] Second.
612Date: DATE-STRING
613Message-Id: MESSAGE-ID-STRING
614X-Mailer: X-MAILER-STRING
615
616Result: OK
617EOF
618"
619
620test_expect_success $PREREQ '--suppress-cc=sob' '
621 test_might_fail git config --unset sendemail.cccmd &&
622 test_suppression sob
623'
624
625test_expect_success $PREREQ 'setup expect' "
626cat >expected-suppress-bodycc <<\EOF
6270001-Second.patch
628(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
629(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
630(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
631(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
632Dry-OK. Log says:
633Server: relay.example.com
634MAIL FROM:<from@example.com>
635RCPT TO:<to@example.com>
636RCPT TO:<author@example.com>
637RCPT TO:<one@example.com>
638RCPT TO:<two@example.com>
639RCPT TO:<committer@example.com>
640From: Example <from@example.com>
641To: to@example.com
642Cc: A <author@example.com>,
643 One <one@example.com>,
644 two@example.com,
645 C O Mitter <committer@example.com>
646Subject: [PATCH 1/1] Second.
647Date: DATE-STRING
648Message-Id: MESSAGE-ID-STRING
649X-Mailer: X-MAILER-STRING
650
651Result: OK
652EOF
653"
654
655test_expect_success $PREREQ '--suppress-cc=bodycc' '
656 test_suppression bodycc
657'
658
659test_expect_success $PREREQ 'setup expect' "
660cat >expected-suppress-cc <<\EOF
6610001-Second.patch
662(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
663(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
664Dry-OK. Log says:
665Server: relay.example.com
666MAIL FROM:<from@example.com>
667RCPT TO:<to@example.com>
668RCPT TO:<author@example.com>
669RCPT TO:<committer@example.com>
670From: Example <from@example.com>
671To: to@example.com
672Cc: A <author@example.com>,
673 C O Mitter <committer@example.com>
674Subject: [PATCH 1/1] Second.
675Date: DATE-STRING
676Message-Id: MESSAGE-ID-STRING
677X-Mailer: X-MAILER-STRING
678
679Result: OK
680EOF
681"
682
683test_expect_success $PREREQ '--suppress-cc=cc' '
684 test_suppression cc
685'
686
687test_confirm () {
688 echo y | \
689 GIT_SEND_EMAIL_NOTTY=1 \
690 git send-email \
691 --from="Example <nobody@example.com>" \
692 --to=nobody@example.com \
693 --smtp-server="$(pwd)/fake.sendmail" \
694 $@ $patches > stdout &&
695 grep "Send this email" stdout
696}
697
698test_expect_success $PREREQ '--confirm=always' '
699 test_confirm --confirm=always --suppress-cc=all
700'
701
702test_expect_success $PREREQ '--confirm=auto' '
703 test_confirm --confirm=auto
704'
705
706test_expect_success $PREREQ '--confirm=cc' '
707 test_confirm --confirm=cc
708'
709
710test_expect_success $PREREQ '--confirm=compose' '
711 test_confirm --confirm=compose --compose
712'
713
714test_expect_success $PREREQ 'confirm by default (due to cc)' '
715 CONFIRM=$(git config --get sendemail.confirm) &&
716 git config --unset sendemail.confirm &&
717 test_confirm
718 ret="$?"
719 git config sendemail.confirm ${CONFIRM:-never}
720 test $ret = "0"
721'
722
723test_expect_success $PREREQ 'confirm by default (due to --compose)' '
724 CONFIRM=$(git config --get sendemail.confirm) &&
725 git config --unset sendemail.confirm &&
726 test_confirm --suppress-cc=all --compose
727 ret="$?"
728 git config sendemail.confirm ${CONFIRM:-never}
729 test $ret = "0"
730'
731
732test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
733 CONFIRM=$(git config --get sendemail.confirm) &&
734 git config --unset sendemail.confirm &&
735 rm -fr outdir &&
736 git format-patch -2 -o outdir &&
737 GIT_SEND_EMAIL_NOTTY=1 \
738 git send-email \
739 --from="Example <nobody@example.com>" \
740 --to=nobody@example.com \
741 --smtp-server="$(pwd)/fake.sendmail" \
742 outdir/*.patch < /dev/null
743 ret="$?"
744 git config sendemail.confirm ${CONFIRM:-never}
745 test $ret = "0"
746'
747
748test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
749 CONFIRM=$(git config --get sendemail.confirm) &&
750 git config sendemail.confirm auto &&
751 GIT_SEND_EMAIL_NOTTY=1 &&
752 export GIT_SEND_EMAIL_NOTTY &&
753 test_must_fail git send-email \
754 --from="Example <nobody@example.com>" \
755 --to=nobody@example.com \
756 --smtp-server="$(pwd)/fake.sendmail" \
757 $patches < /dev/null
758 ret="$?"
759 git config sendemail.confirm ${CONFIRM:-never}
760 test $ret = "0"
761'
762
763test_expect_success $PREREQ 'confirm doesnt loop forever' '
764 CONFIRM=$(git config --get sendemail.confirm) &&
765 git config sendemail.confirm auto &&
766 GIT_SEND_EMAIL_NOTTY=1 &&
767 export GIT_SEND_EMAIL_NOTTY &&
768 yes "bogus" | test_must_fail git send-email \
769 --from="Example <nobody@example.com>" \
770 --to=nobody@example.com \
771 --smtp-server="$(pwd)/fake.sendmail" \
772 $patches
773 ret="$?"
774 git config sendemail.confirm ${CONFIRM:-never}
775 test $ret = "0"
776'
777
778test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
779 clean_fake_sendmail &&
780 rm -fr outdir &&
781 git format-patch -1 -o outdir --cc="àéìöú <utf8@example.com>" &&
782 git send-email \
783 --from="Example <nobody@example.com>" \
784 --to=nobody@example.com \
785 --smtp-server="$(pwd)/fake.sendmail" \
786 outdir/*.patch &&
787 grep "^ " msgtxt1 |
788 grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
789'
790
791test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
792 clean_fake_sendmail &&
793 (echo "#!$SHELL_PATH" &&
794 echo "echo utf8 body: àéìöú >>\"\$1\""
795 ) >fake-editor-utf8 &&
796 chmod +x fake-editor-utf8 &&
797 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
798 git send-email \
799 --compose --subject foo \
800 --from="Example <nobody@example.com>" \
801 --to=nobody@example.com \
802 --smtp-server="$(pwd)/fake.sendmail" \
803 $patches &&
804 grep "^utf8 body" msgtxt1 &&
805 grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
806'
807
808test_expect_success $PREREQ '--compose respects user mime type' '
809 clean_fake_sendmail &&
810 (echo "#!$SHELL_PATH" &&
811 echo "(echo MIME-Version: 1.0"
812 echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
813 echo " echo Content-Transfer-Encoding: 8bit"
814 echo " echo Subject: foo"
815 echo " echo "
816 echo " echo utf8 body: àéìöú) >\"\$1\""
817 ) >fake-editor-utf8-mime &&
818 chmod +x fake-editor-utf8-mime &&
819 GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
820 git send-email \
821 --compose --subject foo \
822 --from="Example <nobody@example.com>" \
823 --to=nobody@example.com \
824 --smtp-server="$(pwd)/fake.sendmail" \
825 $patches &&
826 grep "^utf8 body" msgtxt1 &&
827 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
828 ! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
829'
830
831test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
832 clean_fake_sendmail &&
833 GIT_EDITOR="\"$(pwd)/fake-editor\"" \
834 git send-email \
835 --compose --subject utf8-sübjëct \
836 --from="Example <nobody@example.com>" \
837 --to=nobody@example.com \
838 --smtp-server="$(pwd)/fake.sendmail" \
839 $patches &&
840 grep "^fake edit" msgtxt1 &&
841 grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
842'
843
844test_expect_success $PREREQ 'utf8 author is correctly passed on' '
845 clean_fake_sendmail &&
846 test_commit weird_author &&
847 test_when_finished "git reset --hard HEAD^" &&
848 git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
849 git format-patch --stdout -1 >funny_name.patch &&
850 git send-email --from="Example <nobody@example.com>" \
851 --to=nobody@example.com \
852 --smtp-server="$(pwd)/fake.sendmail" \
853 funny_name.patch &&
854 grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
855'
856
857test_expect_success $PREREQ 'sendemail.composeencoding works' '
858 clean_fake_sendmail &&
859 git config sendemail.composeencoding iso-8859-1 &&
860 (echo "#!$SHELL_PATH" &&
861 echo "echo utf8 body: àéìöú >>\"\$1\""
862 ) >fake-editor-utf8 &&
863 chmod +x fake-editor-utf8 &&
864 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
865 git send-email \
866 --compose --subject foo \
867 --from="Example <nobody@example.com>" \
868 --to=nobody@example.com \
869 --smtp-server="$(pwd)/fake.sendmail" \
870 $patches &&
871 grep "^utf8 body" msgtxt1 &&
872 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
873'
874
875test_expect_success $PREREQ '--compose-encoding works' '
876 clean_fake_sendmail &&
877 (echo "#!$SHELL_PATH" &&
878 echo "echo utf8 body: àéìöú >>\"\$1\""
879 ) >fake-editor-utf8 &&
880 chmod +x fake-editor-utf8 &&
881 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
882 git send-email \
883 --compose-encoding iso-8859-1 \
884 --compose --subject foo \
885 --from="Example <nobody@example.com>" \
886 --to=nobody@example.com \
887 --smtp-server="$(pwd)/fake.sendmail" \
888 $patches &&
889 grep "^utf8 body" msgtxt1 &&
890 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
891'
892
893test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
894 clean_fake_sendmail &&
895 git config sendemail.composeencoding iso-8859-1 &&
896 (echo "#!$SHELL_PATH" &&
897 echo "echo utf8 body: àéìöú >>\"\$1\""
898 ) >fake-editor-utf8 &&
899 chmod +x fake-editor-utf8 &&
900 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
901 git send-email \
902 --compose-encoding iso-8859-2 \
903 --compose --subject foo \
904 --from="Example <nobody@example.com>" \
905 --to=nobody@example.com \
906 --smtp-server="$(pwd)/fake.sendmail" \
907 $patches &&
908 grep "^utf8 body" msgtxt1 &&
909 grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
910'
911
912test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
913 echo master > master &&
914 git add master &&
915 git commit -m"add master" &&
916 test_must_fail git send-email --dry-run master 2>errors &&
917 grep disambiguate errors
918'
919
920test_expect_success $PREREQ 'feed two files' '
921 rm -fr outdir &&
922 git format-patch -2 -o outdir &&
923 git send-email \
924 --dry-run \
925 --from="Example <nobody@example.com>" \
926 --to=nobody@example.com \
927 outdir/000?-*.patch 2>errors >out &&
928 grep "^Subject: " out >subjects &&
929 test "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&
930 test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"
931'
932
933test_expect_success $PREREQ 'in-reply-to but no threading' '
934 git send-email \
935 --dry-run \
936 --from="Example <nobody@example.com>" \
937 --to=nobody@example.com \
938 --in-reply-to="<in-reply-id@example.com>" \
939 --nothread \
940 $patches |
941 grep "In-Reply-To: <in-reply-id@example.com>"
942'
943
944test_expect_success $PREREQ 'no in-reply-to and no threading' '
945 git send-email \
946 --dry-run \
947 --from="Example <nobody@example.com>" \
948 --to=nobody@example.com \
949 --nothread \
950 $patches $patches >stdout &&
951 ! grep "In-Reply-To: " stdout
952'
953
954test_expect_success $PREREQ 'threading but no chain-reply-to' '
955 git send-email \
956 --dry-run \
957 --from="Example <nobody@example.com>" \
958 --to=nobody@example.com \
959 --thread \
960 --nochain-reply-to \
961 $patches $patches >stdout &&
962 grep "In-Reply-To: " stdout
963'
964
965test_expect_success $PREREQ 'warning with an implicit --chain-reply-to' '
966 git send-email \
967 --dry-run \
968 --from="Example <nobody@example.com>" \
969 --to=nobody@example.com \
970 outdir/000?-*.patch 2>errors >out &&
971 grep "no-chain-reply-to" errors
972'
973
974test_expect_success $PREREQ 'no warning with an explicit --chain-reply-to' '
975 git send-email \
976 --dry-run \
977 --from="Example <nobody@example.com>" \
978 --to=nobody@example.com \
979 --chain-reply-to \
980 outdir/000?-*.patch 2>errors >out &&
981 ! grep "no-chain-reply-to" errors
982'
983
984test_expect_success $PREREQ 'no warning with an explicit --no-chain-reply-to' '
985 git send-email \
986 --dry-run \
987 --from="Example <nobody@example.com>" \
988 --to=nobody@example.com \
989 --nochain-reply-to \
990 outdir/000?-*.patch 2>errors >out &&
991 ! grep "no-chain-reply-to" errors
992'
993
994test_expect_success $PREREQ 'no warning with sendemail.chainreplyto = false' '
995 git config sendemail.chainreplyto false &&
996 git send-email \
997 --dry-run \
998 --from="Example <nobody@example.com>" \
999 --to=nobody@example.com \
1000 outdir/000?-*.patch 2>errors >out &&
1001 ! grep "no-chain-reply-to" errors
1002'
1003
1004test_expect_success $PREREQ 'no warning with sendemail.chainreplyto = true' '
1005 git config sendemail.chainreplyto true &&
1006 git send-email \
1007 --dry-run \
1008 --from="Example <nobody@example.com>" \
1009 --to=nobody@example.com \
1010 outdir/000?-*.patch 2>errors >out &&
1011 ! grep "no-chain-reply-to" errors
1012'
1013
1014test_expect_success $PREREQ 'sendemail.to works' '
1015 git config --replace-all sendemail.to "Somebody <somebody@ex.com>" &&
1016 git send-email \
1017 --dry-run \
1018 --from="Example <nobody@example.com>" \
1019 $patches $patches >stdout &&
1020 grep "To: Somebody <somebody@ex.com>" stdout
1021'
1022
1023test_expect_success $PREREQ '--no-to overrides sendemail.to' '
1024 git send-email \
1025 --dry-run \
1026 --from="Example <nobody@example.com>" \
1027 --no-to \
1028 --to=nobody@example.com \
1029 $patches $patches >stdout &&
1030 grep "To: nobody@example.com" stdout &&
1031 ! grep "To: Somebody <somebody@ex.com>" stdout
1032'
1033
1034test_expect_success $PREREQ 'sendemail.cc works' '
1035 git config --replace-all sendemail.cc "Somebody <somebody@ex.com>" &&
1036 git send-email \
1037 --dry-run \
1038 --from="Example <nobody@example.com>" \
1039 --to=nobody@example.com \
1040 $patches $patches >stdout &&
1041 grep "Cc: Somebody <somebody@ex.com>" stdout
1042'
1043
1044test_expect_success $PREREQ '--no-cc overrides sendemail.cc' '
1045 git send-email \
1046 --dry-run \
1047 --from="Example <nobody@example.com>" \
1048 --no-cc \
1049 --cc=bodies@example.com \
1050 --to=nobody@example.com \
1051 $patches $patches >stdout &&
1052 grep "Cc: bodies@example.com" stdout &&
1053 ! grep "Cc: Somebody <somebody@ex.com>" stdout
1054'
1055
1056test_expect_success $PREREQ 'sendemail.bcc works' '
1057 git config --replace-all sendemail.bcc "Other <other@ex.com>" &&
1058 git send-email \
1059 --dry-run \
1060 --from="Example <nobody@example.com>" \
1061 --to=nobody@example.com \
1062 --smtp-server relay.example.com \
1063 $patches $patches >stdout &&
1064 grep "RCPT TO:<other@ex.com>" stdout
1065'
1066
1067test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
1068 git send-email \
1069 --dry-run \
1070 --from="Example <nobody@example.com>" \
1071 --no-bcc \
1072 --bcc=bodies@example.com \
1073 --to=nobody@example.com \
1074 --smtp-server relay.example.com \
1075 $patches $patches >stdout &&
1076 grep "RCPT TO:<bodies@example.com>" stdout &&
1077 ! grep "RCPT TO:<other@ex.com>" stdout
1078'
1079
1080test_expect_success $PREREQ 'patches To headers are used by default' '
1081 patch=`git format-patch -1 --to="bodies@example.com"` &&
1082 test_when_finished "rm $patch" &&
1083 git send-email \
1084 --dry-run \
1085 --from="Example <nobody@example.com>" \
1086 --smtp-server relay.example.com \
1087 $patch >stdout &&
1088 grep "RCPT TO:<bodies@example.com>" stdout
1089'
1090
1091test_expect_success $PREREQ 'patches To headers are appended to' '
1092 patch=`git format-patch -1 --to="bodies@example.com"` &&
1093 test_when_finished "rm $patch" &&
1094 git send-email \
1095 --dry-run \
1096 --from="Example <nobody@example.com>" \
1097 --to=nobody@example.com \
1098 --smtp-server relay.example.com \
1099 $patch >stdout &&
1100 grep "RCPT TO:<bodies@example.com>" stdout &&
1101 grep "RCPT TO:<nobody@example.com>" stdout
1102'
1103
1104test_expect_success $PREREQ 'To headers from files reset each patch' '
1105 patch1=`git format-patch -1 --to="bodies@example.com"` &&
1106 patch2=`git format-patch -1 --to="other@example.com" HEAD~` &&
1107 test_when_finished "rm $patch1 && rm $patch2" &&
1108 git send-email \
1109 --dry-run \
1110 --from="Example <nobody@example.com>" \
1111 --to="nobody@example.com" \
1112 --smtp-server relay.example.com \
1113 $patch1 $patch2 >stdout &&
1114 test $(grep -c "RCPT TO:<bodies@example.com>" stdout) = 1 &&
1115 test $(grep -c "RCPT TO:<nobody@example.com>" stdout) = 2 &&
1116 test $(grep -c "RCPT TO:<other@example.com>" stdout) = 1
1117'
1118
1119test_expect_success $PREREQ 'setup expect' '
1120cat >email-using-8bit <<EOF
1121From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
1122Message-Id: <bogus-message-id@example.com>
1123From: author@example.com
1124Date: Sat, 12 Jun 2010 15:53:58 +0200
1125Subject: subject goes here
1126
1127Dieser deutsche Text enthält einen Umlaut!
1128EOF
1129'
1130
1131test_expect_success $PREREQ 'setup expect' '
1132cat >content-type-decl <<EOF
1133MIME-Version: 1.0
1134Content-Type: text/plain; charset=UTF-8
1135Content-Transfer-Encoding: 8bit
1136EOF
1137'
1138
1139test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
1140 clean_fake_sendmail &&
1141 echo |
1142 git send-email --from=author@example.com --to=nobody@example.com \
1143 --smtp-server="$(pwd)/fake.sendmail" \
1144 email-using-8bit >stdout &&
1145 grep "do not declare a Content-Transfer-Encoding" stdout &&
1146 grep email-using-8bit stdout &&
1147 grep "Which 8bit encoding" stdout &&
1148 egrep "Content|MIME" msgtxt1 >actual &&
1149 test_cmp actual content-type-decl
1150'
1151
1152test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
1153 clean_fake_sendmail &&
1154 git config sendemail.assume8bitEncoding UTF-8 &&
1155 echo bogus |
1156 git send-email --from=author@example.com --to=nobody@example.com \
1157 --smtp-server="$(pwd)/fake.sendmail" \
1158 email-using-8bit >stdout &&
1159 egrep "Content|MIME" msgtxt1 >actual &&
1160 test_cmp actual content-type-decl
1161'
1162
1163test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
1164 clean_fake_sendmail &&
1165 git config sendemail.assume8bitEncoding "bogus too" &&
1166 echo bogus |
1167 git send-email --from=author@example.com --to=nobody@example.com \
1168 --smtp-server="$(pwd)/fake.sendmail" \
1169 --8bit-encoding=UTF-8 \
1170 email-using-8bit >stdout &&
1171 egrep "Content|MIME" msgtxt1 >actual &&
1172 test_cmp actual content-type-decl
1173'
1174
1175test_expect_success $PREREQ 'setup expect' '
1176cat >email-using-8bit <<EOF
1177From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
1178Message-Id: <bogus-message-id@example.com>
1179From: author@example.com
1180Date: Sat, 12 Jun 2010 15:53:58 +0200
1181Subject: Dieser Betreff enthält auch einen Umlaut!
1182
1183Nothing to see here.
1184EOF
1185'
1186
1187test_expect_success $PREREQ 'setup expect' '
1188cat >expected <<EOF
1189Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
1190EOF
1191'
1192
1193test_expect_success $PREREQ '--8bit-encoding also treats subject' '
1194 clean_fake_sendmail &&
1195 echo bogus |
1196 git send-email --from=author@example.com --to=nobody@example.com \
1197 --smtp-server="$(pwd)/fake.sendmail" \
1198 --8bit-encoding=UTF-8 \
1199 email-using-8bit >stdout &&
1200 grep "Subject" msgtxt1 >actual &&
1201 test_cmp expected actual
1202'
1203
1204# Note that the patches in this test are deliberately out of order; we
1205# want to make sure it works even if the cover-letter is not in the
1206# first mail.
1207test_expect_success $PREREQ 'refusing to send cover letter template' '
1208 clean_fake_sendmail &&
1209 rm -fr outdir &&
1210 git format-patch --cover-letter -2 -o outdir &&
1211 test_must_fail git send-email \
1212 --from="Example <nobody@example.com>" \
1213 --to=nobody@example.com \
1214 --smtp-server="$(pwd)/fake.sendmail" \
1215 outdir/0002-*.patch \
1216 outdir/0000-*.patch \
1217 outdir/0001-*.patch \
1218 2>errors >out &&
1219 grep "SUBJECT HERE" errors &&
1220 test -z "$(ls msgtxt*)"
1221'
1222
1223test_expect_success $PREREQ '--force sends cover letter template anyway' '
1224 clean_fake_sendmail &&
1225 rm -fr outdir &&
1226 git format-patch --cover-letter -2 -o outdir &&
1227 git send-email \
1228 --force \
1229 --from="Example <nobody@example.com>" \
1230 --to=nobody@example.com \
1231 --smtp-server="$(pwd)/fake.sendmail" \
1232 outdir/0002-*.patch \
1233 outdir/0000-*.patch \
1234 outdir/0001-*.patch \
1235 2>errors >out &&
1236 ! grep "SUBJECT HERE" errors &&
1237 test -n "$(ls msgtxt*)"
1238'
1239
1240test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
1241 clean_fake_sendmail &&
1242 echo "alias sbd somebody@example.org" >.mailrc &&
1243 git config --replace-all sendemail.aliasesfile "$(pwd)/.mailrc" &&
1244 git config sendemail.aliasfiletype mailrc &&
1245 git send-email \
1246 --from="Example <nobody@example.com>" \
1247 --to=sbd \
1248 --smtp-server="$(pwd)/fake.sendmail" \
1249 outdir/0001-*.patch \
1250 2>errors >out &&
1251 grep "^!somebody@example\.org!$" commandline1
1252'
1253
1254test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
1255 clean_fake_sendmail &&
1256 echo "alias sbd someone@example.org" >~/.mailrc &&
1257 git config --replace-all sendemail.aliasesfile "~/.mailrc" &&
1258 git config sendemail.aliasfiletype mailrc &&
1259 git send-email \
1260 --from="Example <nobody@example.com>" \
1261 --to=sbd \
1262 --smtp-server="$(pwd)/fake.sendmail" \
1263 outdir/0001-*.patch \
1264 2>errors >out &&
1265 grep "^!someone@example\.org!$" commandline1
1266'
1267
1268test_done