git-remote-hg: add GitExporter/GitImporter/NonLocalGit
[git/mingw/4msysgit.git] / t / t9001-send-email.sh
blob4108b60a36f822fcd2638eabf2870a15ca865b44
1 #!/bin/sh
3 test_description='git send-email'
4 . ./test-lib.sh
6 # May be altered later in the test
7 PREREQ="PERL"
9 test_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."'
16 test_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 echo "cat > msgtxt\$output"
27 ) >fake.sendmail &&
28 chmod +x ./fake.sendmail &&
29 git add fake.sendmail &&
30 GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
32 clean_fake_sendmail() {
33 rm -f commandline* msgtxt*
36 test_expect_success $PREREQ 'Extract patches' '
37 patches=`git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1`
40 # Test no confirm early to ensure remaining tests will not hang
41 test_no_confirm () {
42 rm -f no_confirm_okay
43 echo n | \
44 GIT_SEND_EMAIL_NOTTY=1 \
45 git send-email \
46 --from="Example <from@example.com>" \
47 --to=nobody@example.com \
48 --smtp-server="$(pwd)/fake.sendmail" \
49 $@ \
50 $patches > stdout &&
51 test_must_fail grep "Send this email" stdout &&
52 > no_confirm_okay
55 # Exit immediately to prevent hang if a no-confirm test fails
56 check_no_confirm () {
57 if ! test -f no_confirm_okay
58 then
59 say 'confirm test failed; skipping remaining tests to prevent hanging'
60 PREREQ="$PREREQ,CHECK_NO_CONFIRM"
62 return 0
65 test_expect_success $PREREQ 'No confirm with --suppress-cc' '
66 test_no_confirm --suppress-cc=sob &&
67 check_no_confirm
71 test_expect_success $PREREQ 'No confirm with --confirm=never' '
72 test_no_confirm --confirm=never &&
73 check_no_confirm
76 # leave sendemail.confirm set to never after this so that none of the
77 # remaining tests prompt unintentionally.
78 test_expect_success $PREREQ 'No confirm with sendemail.confirm=never' '
79 git config sendemail.confirm never &&
80 test_no_confirm --compose --subject=foo &&
81 check_no_confirm
84 test_expect_success $PREREQ 'Send patches' '
85 git send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
88 test_expect_success $PREREQ 'setup expect' '
89 cat >expected <<\EOF
90 !nobody@example.com!
91 !author@example.com!
92 !one@example.com!
93 !two@example.com!
94 EOF
97 test_expect_success $PREREQ \
98 'Verify commandline' \
99 'test_cmp_text expected commandline1'
101 test_expect_success $PREREQ 'Send patches with --envelope-sender' '
102 clean_fake_sendmail &&
103 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
106 test_expect_success $PREREQ 'setup expect' '
107 cat >expected <<\EOF
108 !patch@example.com!
109 !-i!
110 !nobody@example.com!
111 !author@example.com!
112 !one@example.com!
113 !two@example.com!
117 test_expect_success $PREREQ \
118 'Verify commandline' \
119 'test_cmp_text expected commandline1'
121 test_expect_success $PREREQ 'Send patches with --envelope-sender=auto' '
122 clean_fake_sendmail &&
123 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
126 test_expect_success $PREREQ 'setup expect' '
127 cat >expected <<\EOF
128 !nobody@example.com!
129 !-i!
130 !nobody@example.com!
131 !author@example.com!
132 !one@example.com!
133 !two@example.com!
137 test_expect_success $PREREQ \
138 'Verify commandline' \
139 'test_cmp_text expected commandline1'
141 test_expect_success $PREREQ 'setup expect' "
142 cat >expected-show-all-headers <<\EOF
143 0001-Second.patch
144 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
145 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
146 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
147 Dry-OK. Log says:
148 Server: relay.example.com
149 MAIL FROM:<from@example.com>
150 RCPT TO:<to@example.com>
151 RCPT TO:<cc@example.com>
152 RCPT TO:<author@example.com>
153 RCPT TO:<one@example.com>
154 RCPT TO:<two@example.com>
155 RCPT TO:<bcc@example.com>
156 From: Example <from@example.com>
157 To: to@example.com
158 Cc: cc@example.com,
159 A <author@example.com>,
160 One <one@example.com>,
161 two@example.com
162 Subject: [PATCH 1/1] Second.
163 Date: DATE-STRING
164 Message-Id: MESSAGE-ID-STRING
165 X-Mailer: X-MAILER-STRING
166 In-Reply-To: <unique-message-id@example.com>
167 References: <unique-message-id@example.com>
169 Result: OK
173 test_expect_success $PREREQ 'Show all headers' '
174 git send-email \
175 --dry-run \
176 --suppress-cc=sob \
177 --from="Example <from@example.com>" \
178 --to=to@example.com \
179 --cc=cc@example.com \
180 --bcc=bcc@example.com \
181 --in-reply-to="<unique-message-id@example.com>" \
182 --smtp-server relay.example.com \
183 $patches |
184 sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
185 -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
186 -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
187 >actual-show-all-headers &&
188 test_cmp_text expected-show-all-headers actual-show-all-headers
191 test_expect_success $PREREQ 'Prompting works' '
192 clean_fake_sendmail &&
193 (echo "to@example.com"
194 echo ""
195 ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
196 --smtp-server="$(pwd)/fake.sendmail" \
197 $patches \
198 2>errors &&
199 grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
200 grep "^To: to@example.com\$" msgtxt1
203 test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '
204 clean_fake_sendmail &&
205 (sane_unset GIT_AUTHOR_NAME &&
206 sane_unset GIT_AUTHOR_EMAIL &&
207 sane_unset GIT_COMMITTER_NAME &&
208 sane_unset GIT_COMMITTER_EMAIL &&
209 GIT_SEND_EMAIL_NOTTY=1 git send-email \
210 --smtp-server="$(pwd)/fake.sendmail" \
211 --to=to@example.com \
212 $patches </dev/null 2>errors
216 test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' '
217 clean_fake_sendmail &&
218 (sane_unset GIT_AUTHOR_NAME &&
219 sane_unset GIT_AUTHOR_EMAIL &&
220 sane_unset GIT_COMMITTER_NAME &&
221 sane_unset GIT_COMMITTER_EMAIL &&
222 GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY &&
223 test_must_fail git send-email \
224 --smtp-server="$(pwd)/fake.sendmail" \
225 --to=to@example.com \
226 $patches </dev/null 2>errors &&
227 test_i18ngrep "tell me who you are" errors
231 test_expect_success $PREREQ 'tocmd works' '
232 clean_fake_sendmail &&
233 cp $patches tocmd.patch &&
234 echo tocmd--tocmd@example.com >>tocmd.patch &&
236 echo "#!$SHELL_PATH"
237 echo sed -n -e s/^tocmd--//p \"\$1\"
238 } > tocmd-sed &&
239 chmod +x tocmd-sed &&
240 git send-email \
241 --from="Example <nobody@example.com>" \
242 --to-cmd=./tocmd-sed \
243 --smtp-server="$(pwd)/fake.sendmail" \
244 tocmd.patch \
246 grep "^To: tocmd@example.com" msgtxt1
249 test_expect_success $PREREQ 'cccmd works' '
250 clean_fake_sendmail &&
251 cp $patches cccmd.patch &&
252 echo "cccmd-- cccmd@example.com" >>cccmd.patch &&
254 echo "#!$SHELL_PATH"
255 echo sed -n -e s/^cccmd--//p \"\$1\"
256 } > cccmd-sed &&
257 chmod +x cccmd-sed &&
258 git send-email \
259 --from="Example <nobody@example.com>" \
260 --to=nobody@example.com \
261 --cc-cmd=./cccmd-sed \
262 --smtp-server="$(pwd)/fake.sendmail" \
263 cccmd.patch \
265 grep "^ cccmd@example.com" msgtxt1
268 test_expect_success $PREREQ 'reject long lines' '
269 z8=zzzzzzzz &&
270 z64=$z8$z8$z8$z8$z8$z8$z8$z8 &&
271 z512=$z64$z64$z64$z64$z64$z64$z64$z64 &&
272 clean_fake_sendmail &&
273 cp $patches longline.patch &&
274 echo $z512$z512 >>longline.patch &&
275 test_must_fail git send-email \
276 --from="Example <nobody@example.com>" \
277 --to=nobody@example.com \
278 --smtp-server="$(pwd)/fake.sendmail" \
279 $patches longline.patch \
280 2>errors &&
281 grep longline.patch errors
284 test_expect_success $PREREQ 'no patch was sent' '
285 ! test -e commandline1
288 test_expect_success $PREREQ 'Author From: in message body' '
289 clean_fake_sendmail &&
290 git send-email \
291 --from="Example <nobody@example.com>" \
292 --to=nobody@example.com \
293 --smtp-server="$(pwd)/fake.sendmail" \
294 $patches &&
295 sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
296 grep "From: A <author@example.com>" msgbody1
299 test_expect_success $PREREQ 'Author From: not in message body' '
300 clean_fake_sendmail &&
301 git send-email \
302 --from="A <author@example.com>" \
303 --to=nobody@example.com \
304 --smtp-server="$(pwd)/fake.sendmail" \
305 $patches &&
306 sed "1,/^\$/d" < msgtxt1 > msgbody1 &&
307 ! grep "From: A <author@example.com>" msgbody1
310 test_expect_success $PREREQ 'allow long lines with --no-validate' '
311 git send-email \
312 --from="Example <nobody@example.com>" \
313 --to=nobody@example.com \
314 --smtp-server="$(pwd)/fake.sendmail" \
315 --novalidate \
316 $patches longline.patch \
317 2>errors
320 test_expect_success $PREREQ 'Invalid In-Reply-To' '
321 clean_fake_sendmail &&
322 git send-email \
323 --from="Example <nobody@example.com>" \
324 --to=nobody@example.com \
325 --in-reply-to=" " \
326 --smtp-server="$(pwd)/fake.sendmail" \
327 $patches \
328 2>errors &&
329 ! grep "^In-Reply-To: < *>" msgtxt1
332 test_expect_success $PREREQ 'Valid In-Reply-To when prompting' '
333 clean_fake_sendmail &&
334 (echo "From Example <from@example.com>"
335 echo "To Example <to@example.com>"
336 echo ""
337 ) | env GIT_SEND_EMAIL_NOTTY=1 git send-email \
338 --smtp-server="$(pwd)/fake.sendmail" \
339 $patches 2>errors &&
340 ! grep "^In-Reply-To: < *>" msgtxt1
343 test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' '
344 clean_fake_sendmail &&
345 echo "<unique-message-id@example.com>" >expect &&
346 git send-email \
347 --from="Example <nobody@example.com>" \
348 --to=nobody@example.com \
349 --nochain-reply-to \
350 --in-reply-to="$(cat expect)" \
351 --smtp-server="$(pwd)/fake.sendmail" \
352 $patches $patches $patches \
353 2>errors &&
354 # The first message is a reply to --in-reply-to
355 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
356 test_cmp_text expect actual &&
357 # Second and subsequent messages are replies to the first one
358 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
359 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
360 test_cmp_text expect actual &&
361 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
362 test_cmp_text expect actual
365 test_expect_success $PREREQ 'In-Reply-To with --chain-reply-to' '
366 clean_fake_sendmail &&
367 echo "<unique-message-id@example.com>" >expect &&
368 git send-email \
369 --from="Example <nobody@example.com>" \
370 --to=nobody@example.com \
371 --chain-reply-to \
372 --in-reply-to="$(cat expect)" \
373 --smtp-server="$(pwd)/fake.sendmail" \
374 $patches $patches $patches \
375 2>errors &&
376 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt1 >actual &&
377 test_cmp_text expect actual &&
378 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt1 >expect &&
379 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt2 >actual &&
380 test_cmp_text expect actual &&
381 sed -n -e "s/^Message-Id: *\(.*\)/\1/p" msgtxt2 >expect &&
382 sed -n -e "s/^In-Reply-To: *\(.*\)/\1/p" msgtxt3 >actual &&
383 test_cmp_text expect actual
386 test_expect_success $PREREQ 'setup fake editor' '
387 (echo "#!$SHELL_PATH" &&
388 echo "echo fake edit >>\"\$1\""
389 ) >fake-editor &&
390 chmod +x fake-editor
393 test_set_editor "$(pwd)/fake-editor"
395 test_expect_success $PREREQ '--compose works' '
396 clean_fake_sendmail &&
397 git send-email \
398 --compose --subject foo \
399 --from="Example <nobody@example.com>" \
400 --to=nobody@example.com \
401 --smtp-server="$(pwd)/fake.sendmail" \
402 $patches \
403 2>errors
406 test_expect_success $PREREQ 'first message is compose text' '
407 grep "^fake edit" msgtxt1
410 test_expect_success $PREREQ 'second message is patch' '
411 grep "Subject:.*Second" msgtxt2
414 test_expect_success $PREREQ 'setup expect' "
415 cat >expected-suppress-sob <<\EOF
416 0001-Second.patch
417 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
418 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
419 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
420 Dry-OK. Log says:
421 Server: relay.example.com
422 MAIL FROM:<from@example.com>
423 RCPT TO:<to@example.com>
424 RCPT TO:<cc@example.com>
425 RCPT TO:<author@example.com>
426 RCPT TO:<one@example.com>
427 RCPT TO:<two@example.com>
428 From: Example <from@example.com>
429 To: to@example.com
430 Cc: cc@example.com,
431 A <author@example.com>,
432 One <one@example.com>,
433 two@example.com
434 Subject: [PATCH 1/1] Second.
435 Date: DATE-STRING
436 Message-Id: MESSAGE-ID-STRING
437 X-Mailer: X-MAILER-STRING
439 Result: OK
443 test_suppression () {
444 git send-email \
445 --dry-run \
446 --suppress-cc=$1 ${2+"--suppress-cc=$2"} \
447 --from="Example <from@example.com>" \
448 --to=to@example.com \
449 --smtp-server relay.example.com \
450 $patches |
451 sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \
452 -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
453 -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
454 >actual-suppress-$1${2+"-$2"} &&
455 test_cmp_text expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
458 test_expect_success $PREREQ 'sendemail.cc set' '
459 git config sendemail.cc cc@example.com &&
460 test_suppression sob
463 test_expect_success $PREREQ 'setup expect' "
464 cat >expected-suppress-sob <<\EOF
465 0001-Second.patch
466 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
467 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
468 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
469 Dry-OK. Log says:
470 Server: relay.example.com
471 MAIL FROM:<from@example.com>
472 RCPT TO:<to@example.com>
473 RCPT TO:<author@example.com>
474 RCPT TO:<one@example.com>
475 RCPT TO:<two@example.com>
476 From: Example <from@example.com>
477 To: to@example.com
478 Cc: A <author@example.com>,
479 One <one@example.com>,
480 two@example.com
481 Subject: [PATCH 1/1] Second.
482 Date: DATE-STRING
483 Message-Id: MESSAGE-ID-STRING
484 X-Mailer: X-MAILER-STRING
486 Result: OK
490 test_expect_success $PREREQ 'sendemail.cc unset' '
491 git config --unset sendemail.cc &&
492 test_suppression sob
495 test_expect_success $PREREQ 'setup expect' "
496 cat >expected-suppress-cccmd <<\EOF
497 0001-Second.patch
498 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
499 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
500 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
501 (body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
502 Dry-OK. Log says:
503 Server: relay.example.com
504 MAIL FROM:<from@example.com>
505 RCPT TO:<to@example.com>
506 RCPT TO:<author@example.com>
507 RCPT TO:<one@example.com>
508 RCPT TO:<two@example.com>
509 RCPT TO:<committer@example.com>
510 From: Example <from@example.com>
511 To: to@example.com
512 Cc: A <author@example.com>,
513 One <one@example.com>,
514 two@example.com,
515 C O Mitter <committer@example.com>
516 Subject: [PATCH 1/1] Second.
517 Date: DATE-STRING
518 Message-Id: MESSAGE-ID-STRING
519 X-Mailer: X-MAILER-STRING
521 Result: OK
525 test_expect_success $PREREQ 'sendemail.cccmd' '
526 echo echo cc-cmd@example.com > cccmd &&
527 chmod +x cccmd &&
528 git config sendemail.cccmd ./cccmd &&
529 test_suppression cccmd
532 test_expect_success $PREREQ 'setup expect' '
533 cat >expected-suppress-all <<\EOF
534 0001-Second.patch
535 Dry-OK. Log says:
536 Server: relay.example.com
537 MAIL FROM:<from@example.com>
538 RCPT TO:<to@example.com>
539 From: Example <from@example.com>
540 To: to@example.com
541 Subject: [PATCH 1/1] Second.
542 Date: DATE-STRING
543 Message-Id: MESSAGE-ID-STRING
544 X-Mailer: X-MAILER-STRING
546 Result: OK
550 test_expect_success $PREREQ '--suppress-cc=all' '
551 test_suppression all
554 test_expect_success $PREREQ 'setup expect' "
555 cat >expected-suppress-body <<\EOF
556 0001-Second.patch
557 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
558 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
559 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
560 (cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'
561 Dry-OK. Log says:
562 Server: relay.example.com
563 MAIL FROM:<from@example.com>
564 RCPT TO:<to@example.com>
565 RCPT TO:<author@example.com>
566 RCPT TO:<one@example.com>
567 RCPT TO:<two@example.com>
568 RCPT TO:<cc-cmd@example.com>
569 From: Example <from@example.com>
570 To: to@example.com
571 Cc: A <author@example.com>,
572 One <one@example.com>,
573 two@example.com,
574 cc-cmd@example.com
575 Subject: [PATCH 1/1] Second.
576 Date: DATE-STRING
577 Message-Id: MESSAGE-ID-STRING
578 X-Mailer: X-MAILER-STRING
580 Result: OK
584 test_expect_success $PREREQ '--suppress-cc=body' '
585 test_suppression body
588 test_expect_success $PREREQ 'setup expect' "
589 cat >expected-suppress-body-cccmd <<\EOF
590 0001-Second.patch
591 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
592 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
593 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
594 Dry-OK. Log says:
595 Server: relay.example.com
596 MAIL FROM:<from@example.com>
597 RCPT TO:<to@example.com>
598 RCPT TO:<author@example.com>
599 RCPT TO:<one@example.com>
600 RCPT TO:<two@example.com>
601 From: Example <from@example.com>
602 To: to@example.com
603 Cc: A <author@example.com>,
604 One <one@example.com>,
605 two@example.com
606 Subject: [PATCH 1/1] Second.
607 Date: DATE-STRING
608 Message-Id: MESSAGE-ID-STRING
609 X-Mailer: X-MAILER-STRING
611 Result: OK
615 test_expect_success $PREREQ '--suppress-cc=body --suppress-cc=cccmd' '
616 test_suppression body cccmd
619 test_expect_success $PREREQ 'setup expect' "
620 cat >expected-suppress-sob <<\EOF
621 0001-Second.patch
622 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
623 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
624 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
625 Dry-OK. Log says:
626 Server: relay.example.com
627 MAIL FROM:<from@example.com>
628 RCPT TO:<to@example.com>
629 RCPT TO:<author@example.com>
630 RCPT TO:<one@example.com>
631 RCPT TO:<two@example.com>
632 From: Example <from@example.com>
633 To: to@example.com
634 Cc: A <author@example.com>,
635 One <one@example.com>,
636 two@example.com
637 Subject: [PATCH 1/1] Second.
638 Date: DATE-STRING
639 Message-Id: MESSAGE-ID-STRING
640 X-Mailer: X-MAILER-STRING
642 Result: OK
646 test_expect_success $PREREQ '--suppress-cc=sob' '
647 test_might_fail git config --unset sendemail.cccmd &&
648 test_suppression sob
651 test_expect_success $PREREQ 'setup expect' "
652 cat >expected-suppress-bodycc <<\EOF
653 0001-Second.patch
654 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
655 (mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
656 (mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
657 (body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
658 Dry-OK. Log says:
659 Server: relay.example.com
660 MAIL FROM:<from@example.com>
661 RCPT TO:<to@example.com>
662 RCPT TO:<author@example.com>
663 RCPT TO:<one@example.com>
664 RCPT TO:<two@example.com>
665 RCPT TO:<committer@example.com>
666 From: Example <from@example.com>
667 To: to@example.com
668 Cc: A <author@example.com>,
669 One <one@example.com>,
670 two@example.com,
671 C O Mitter <committer@example.com>
672 Subject: [PATCH 1/1] Second.
673 Date: DATE-STRING
674 Message-Id: MESSAGE-ID-STRING
675 X-Mailer: X-MAILER-STRING
677 Result: OK
681 test_expect_success $PREREQ '--suppress-cc=bodycc' '
682 test_suppression bodycc
685 test_expect_success $PREREQ 'setup expect' "
686 cat >expected-suppress-cc <<\EOF
687 0001-Second.patch
688 (mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
689 (body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
690 Dry-OK. Log says:
691 Server: relay.example.com
692 MAIL FROM:<from@example.com>
693 RCPT TO:<to@example.com>
694 RCPT TO:<author@example.com>
695 RCPT TO:<committer@example.com>
696 From: Example <from@example.com>
697 To: to@example.com
698 Cc: A <author@example.com>,
699 C O Mitter <committer@example.com>
700 Subject: [PATCH 1/1] Second.
701 Date: DATE-STRING
702 Message-Id: MESSAGE-ID-STRING
703 X-Mailer: X-MAILER-STRING
705 Result: OK
709 test_expect_success $PREREQ '--suppress-cc=cc' '
710 test_suppression cc
713 test_confirm () {
714 echo y | \
715 GIT_SEND_EMAIL_NOTTY=1 \
716 git send-email \
717 --from="Example <nobody@example.com>" \
718 --to=nobody@example.com \
719 --smtp-server="$(pwd)/fake.sendmail" \
720 $@ $patches > stdout &&
721 grep "Send this email" stdout
724 test_expect_success $PREREQ '--confirm=always' '
725 test_confirm --confirm=always --suppress-cc=all
728 test_expect_success $PREREQ '--confirm=auto' '
729 test_confirm --confirm=auto
732 test_expect_success $PREREQ '--confirm=cc' '
733 test_confirm --confirm=cc
736 test_expect_success $PREREQ '--confirm=compose' '
737 test_confirm --confirm=compose --compose
740 test_expect_success $PREREQ 'confirm by default (due to cc)' '
741 CONFIRM=$(git config --get sendemail.confirm) &&
742 git config --unset sendemail.confirm &&
743 test_confirm
744 ret="$?"
745 git config sendemail.confirm ${CONFIRM:-never}
746 test $ret = "0"
749 test_expect_success $PREREQ 'confirm by default (due to --compose)' '
750 CONFIRM=$(git config --get sendemail.confirm) &&
751 git config --unset sendemail.confirm &&
752 test_confirm --suppress-cc=all --compose
753 ret="$?"
754 git config sendemail.confirm ${CONFIRM:-never}
755 test $ret = "0"
758 test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
759 CONFIRM=$(git config --get sendemail.confirm) &&
760 git config --unset sendemail.confirm &&
761 rm -fr outdir &&
762 git format-patch -2 -o outdir &&
763 GIT_SEND_EMAIL_NOTTY=1 \
764 git send-email \
765 --from="Example <nobody@example.com>" \
766 --to=nobody@example.com \
767 --smtp-server="$(pwd)/fake.sendmail" \
768 outdir/*.patch < /dev/null
769 ret="$?"
770 git config sendemail.confirm ${CONFIRM:-never}
771 test $ret = "0"
774 test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
775 CONFIRM=$(git config --get sendemail.confirm) &&
776 git config sendemail.confirm auto &&
777 GIT_SEND_EMAIL_NOTTY=1 &&
778 export GIT_SEND_EMAIL_NOTTY &&
779 test_must_fail git send-email \
780 --from="Example <nobody@example.com>" \
781 --to=nobody@example.com \
782 --smtp-server="$(pwd)/fake.sendmail" \
783 $patches < /dev/null
784 ret="$?"
785 git config sendemail.confirm ${CONFIRM:-never}
786 test $ret = "0"
789 test_expect_success $PREREQ 'confirm doesnt loop forever' '
790 CONFIRM=$(git config --get sendemail.confirm) &&
791 git config sendemail.confirm auto &&
792 GIT_SEND_EMAIL_NOTTY=1 &&
793 export GIT_SEND_EMAIL_NOTTY &&
794 yes "bogus" | test_must_fail git send-email \
795 --from="Example <nobody@example.com>" \
796 --to=nobody@example.com \
797 --smtp-server="$(pwd)/fake.sendmail" \
798 $patches
799 ret="$?"
800 git config sendemail.confirm ${CONFIRM:-never}
801 test $ret = "0"
804 test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
805 clean_fake_sendmail &&
806 rm -fr outdir &&
807 git format-patch -1 -o outdir --cc="àéìöú <utf8@example.com>" &&
808 git send-email \
809 --from="Example <nobody@example.com>" \
810 --to=nobody@example.com \
811 --smtp-server="$(pwd)/fake.sendmail" \
812 outdir/*.patch &&
813 grep "^ " msgtxt1 |
814 grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
817 test_expect_success $PREREQ '--compose adds MIME for utf8 body' '
818 clean_fake_sendmail &&
819 (echo "#!$SHELL_PATH" &&
820 echo "echo utf8 body: àéìöú >>\"\$1\""
821 ) >fake-editor-utf8 &&
822 chmod +x fake-editor-utf8 &&
823 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
824 git send-email \
825 --compose --subject foo \
826 --from="Example <nobody@example.com>" \
827 --to=nobody@example.com \
828 --smtp-server="$(pwd)/fake.sendmail" \
829 $patches &&
830 grep "^utf8 body" msgtxt1 &&
831 grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
834 test_expect_success $PREREQ '--compose respects user mime type' '
835 clean_fake_sendmail &&
836 (echo "#!$SHELL_PATH" &&
837 echo "(echo MIME-Version: 1.0"
838 echo " echo Content-Type: text/plain\\; charset=iso-8859-1"
839 echo " echo Content-Transfer-Encoding: 8bit"
840 echo " echo Subject: foo"
841 echo " echo "
842 echo " echo utf8 body: àéìöú) >\"\$1\""
843 ) >fake-editor-utf8-mime &&
844 chmod +x fake-editor-utf8-mime &&
845 GIT_EDITOR="\"$(pwd)/fake-editor-utf8-mime\"" \
846 git send-email \
847 --compose --subject foo \
848 --from="Example <nobody@example.com>" \
849 --to=nobody@example.com \
850 --smtp-server="$(pwd)/fake.sendmail" \
851 $patches &&
852 grep "^utf8 body" msgtxt1 &&
853 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&
854 ! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1
857 test_expect_success $PREREQ '--compose adds MIME for utf8 subject' '
858 clean_fake_sendmail &&
859 GIT_EDITOR="\"$(pwd)/fake-editor\"" \
860 git send-email \
861 --compose --subject utf8-sübjëct \
862 --from="Example <nobody@example.com>" \
863 --to=nobody@example.com \
864 --smtp-server="$(pwd)/fake.sendmail" \
865 $patches &&
866 grep "^fake edit" msgtxt1 &&
867 grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
870 test_expect_success $PREREQ 'utf8 author is correctly passed on' '
871 clean_fake_sendmail &&
872 test_commit weird_author &&
873 test_when_finished "git reset --hard HEAD^" &&
874 git commit --amend --author "Füñný Nâmé <odd_?=mail@example.com>" &&
875 git format-patch --stdout -1 >funny_name.patch &&
876 git send-email --from="Example <nobody@example.com>" \
877 --to=nobody@example.com \
878 --smtp-server="$(pwd)/fake.sendmail" \
879 funny_name.patch &&
880 grep "^From: Füñný Nâmé <odd_?=mail@example.com>" msgtxt1
883 test_expect_success $PREREQ 'sendemail.composeencoding works' '
884 clean_fake_sendmail &&
885 git config sendemail.composeencoding iso-8859-1 &&
886 (echo "#!$SHELL_PATH" &&
887 echo "echo utf8 body: àéìöú >>\"\$1\""
888 ) >fake-editor-utf8 &&
889 chmod +x fake-editor-utf8 &&
890 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
891 git send-email \
892 --compose --subject foo \
893 --from="Example <nobody@example.com>" \
894 --to=nobody@example.com \
895 --smtp-server="$(pwd)/fake.sendmail" \
896 $patches &&
897 grep "^utf8 body" msgtxt1 &&
898 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
901 test_expect_success $PREREQ '--compose-encoding works' '
902 clean_fake_sendmail &&
903 (echo "#!$SHELL_PATH" &&
904 echo "echo utf8 body: àéìöú >>\"\$1\""
905 ) >fake-editor-utf8 &&
906 chmod +x fake-editor-utf8 &&
907 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
908 git send-email \
909 --compose-encoding iso-8859-1 \
910 --compose --subject foo \
911 --from="Example <nobody@example.com>" \
912 --to=nobody@example.com \
913 --smtp-server="$(pwd)/fake.sendmail" \
914 $patches &&
915 grep "^utf8 body" msgtxt1 &&
916 grep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1
919 test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencoding' '
920 clean_fake_sendmail &&
921 git config sendemail.composeencoding iso-8859-1 &&
922 (echo "#!$SHELL_PATH" &&
923 echo "echo utf8 body: àéìöú >>\"\$1\""
924 ) >fake-editor-utf8 &&
925 chmod +x fake-editor-utf8 &&
926 GIT_EDITOR="\"$(pwd)/fake-editor-utf8\"" \
927 git send-email \
928 --compose-encoding iso-8859-2 \
929 --compose --subject foo \
930 --from="Example <nobody@example.com>" \
931 --to=nobody@example.com \
932 --smtp-server="$(pwd)/fake.sendmail" \
933 $patches &&
934 grep "^utf8 body" msgtxt1 &&
935 grep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1
938 test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '
939 clean_fake_sendmail &&
940 GIT_EDITOR="\"$(pwd)/fake-editor\"" \
941 git send-email \
942 --compose-encoding iso-8859-2 \
943 --compose --subject utf8-sübjëct \
944 --from="Example <nobody@example.com>" \
945 --to=nobody@example.com \
946 --smtp-server="$(pwd)/fake.sendmail" \
947 $patches &&
948 grep "^fake edit" msgtxt1 &&
949 grep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1
952 test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '
953 echo master > master &&
954 git add master &&
955 git commit -m"add master" &&
956 test_must_fail git send-email --dry-run master 2>errors &&
957 grep disambiguate errors
960 test_expect_success $PREREQ 'feed two files' '
961 rm -fr outdir &&
962 git format-patch -2 -o outdir &&
963 git send-email \
964 --dry-run \
965 --from="Example <nobody@example.com>" \
966 --to=nobody@example.com \
967 outdir/000?-*.patch 2>errors >out &&
968 grep "^Subject: " out >subjects &&
969 test "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&
970 test "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"
973 test_expect_success $PREREQ 'in-reply-to but no threading' '
974 git send-email \
975 --dry-run \
976 --from="Example <nobody@example.com>" \
977 --to=nobody@example.com \
978 --in-reply-to="<in-reply-id@example.com>" \
979 --nothread \
980 $patches |
981 grep "In-Reply-To: <in-reply-id@example.com>"
984 test_expect_success $PREREQ 'no in-reply-to and no threading' '
985 git send-email \
986 --dry-run \
987 --from="Example <nobody@example.com>" \
988 --to=nobody@example.com \
989 --nothread \
990 $patches $patches >stdout &&
991 ! grep "In-Reply-To: " stdout
994 test_expect_success $PREREQ 'threading but no chain-reply-to' '
995 git send-email \
996 --dry-run \
997 --from="Example <nobody@example.com>" \
998 --to=nobody@example.com \
999 --thread \
1000 --nochain-reply-to \
1001 $patches $patches >stdout &&
1002 grep "In-Reply-To: " stdout
1005 test_expect_success $PREREQ 'warning with an implicit --chain-reply-to' '
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
1014 test_expect_success $PREREQ 'no warning with an explicit --chain-reply-to' '
1015 git send-email \
1016 --dry-run \
1017 --from="Example <nobody@example.com>" \
1018 --to=nobody@example.com \
1019 --chain-reply-to \
1020 outdir/000?-*.patch 2>errors >out &&
1021 ! grep "no-chain-reply-to" errors
1024 test_expect_success $PREREQ 'no warning with an explicit --no-chain-reply-to' '
1025 git send-email \
1026 --dry-run \
1027 --from="Example <nobody@example.com>" \
1028 --to=nobody@example.com \
1029 --nochain-reply-to \
1030 outdir/000?-*.patch 2>errors >out &&
1031 ! grep "no-chain-reply-to" errors
1034 test_expect_success $PREREQ 'no warning with sendemail.chainreplyto = false' '
1035 git config sendemail.chainreplyto false &&
1036 git send-email \
1037 --dry-run \
1038 --from="Example <nobody@example.com>" \
1039 --to=nobody@example.com \
1040 outdir/000?-*.patch 2>errors >out &&
1041 ! grep "no-chain-reply-to" errors
1044 test_expect_success $PREREQ 'no warning with sendemail.chainreplyto = true' '
1045 git config sendemail.chainreplyto true &&
1046 git send-email \
1047 --dry-run \
1048 --from="Example <nobody@example.com>" \
1049 --to=nobody@example.com \
1050 outdir/000?-*.patch 2>errors >out &&
1051 ! grep "no-chain-reply-to" errors
1054 test_expect_success $PREREQ 'sendemail.to works' '
1055 git config --replace-all sendemail.to "Somebody <somebody@ex.com>" &&
1056 git send-email \
1057 --dry-run \
1058 --from="Example <nobody@example.com>" \
1059 $patches $patches >stdout &&
1060 grep "To: Somebody <somebody@ex.com>" stdout
1063 test_expect_success $PREREQ '--no-to overrides sendemail.to' '
1064 git send-email \
1065 --dry-run \
1066 --from="Example <nobody@example.com>" \
1067 --no-to \
1068 --to=nobody@example.com \
1069 $patches $patches >stdout &&
1070 grep "To: nobody@example.com" stdout &&
1071 ! grep "To: Somebody <somebody@ex.com>" stdout
1074 test_expect_success $PREREQ 'sendemail.cc works' '
1075 git config --replace-all sendemail.cc "Somebody <somebody@ex.com>" &&
1076 git send-email \
1077 --dry-run \
1078 --from="Example <nobody@example.com>" \
1079 --to=nobody@example.com \
1080 $patches $patches >stdout &&
1081 grep "Cc: Somebody <somebody@ex.com>" stdout
1084 test_expect_success $PREREQ '--no-cc overrides sendemail.cc' '
1085 git send-email \
1086 --dry-run \
1087 --from="Example <nobody@example.com>" \
1088 --no-cc \
1089 --cc=bodies@example.com \
1090 --to=nobody@example.com \
1091 $patches $patches >stdout &&
1092 grep "Cc: bodies@example.com" stdout &&
1093 ! grep "Cc: Somebody <somebody@ex.com>" stdout
1096 test_expect_success $PREREQ 'sendemail.bcc works' '
1097 git config --replace-all sendemail.bcc "Other <other@ex.com>" &&
1098 git send-email \
1099 --dry-run \
1100 --from="Example <nobody@example.com>" \
1101 --to=nobody@example.com \
1102 --smtp-server relay.example.com \
1103 $patches $patches >stdout &&
1104 grep "RCPT TO:<other@ex.com>" stdout
1107 test_expect_success $PREREQ '--no-bcc overrides sendemail.bcc' '
1108 git send-email \
1109 --dry-run \
1110 --from="Example <nobody@example.com>" \
1111 --no-bcc \
1112 --bcc=bodies@example.com \
1113 --to=nobody@example.com \
1114 --smtp-server relay.example.com \
1115 $patches $patches >stdout &&
1116 grep "RCPT TO:<bodies@example.com>" stdout &&
1117 ! grep "RCPT TO:<other@ex.com>" stdout
1120 test_expect_success $PREREQ 'patches To headers are used by default' '
1121 patch=`git format-patch -1 --to="bodies@example.com"` &&
1122 test_when_finished "rm $patch" &&
1123 git send-email \
1124 --dry-run \
1125 --from="Example <nobody@example.com>" \
1126 --smtp-server relay.example.com \
1127 $patch >stdout &&
1128 grep "RCPT TO:<bodies@example.com>" stdout
1131 test_expect_success $PREREQ 'patches To headers are appended to' '
1132 patch=`git format-patch -1 --to="bodies@example.com"` &&
1133 test_when_finished "rm $patch" &&
1134 git send-email \
1135 --dry-run \
1136 --from="Example <nobody@example.com>" \
1137 --to=nobody@example.com \
1138 --smtp-server relay.example.com \
1139 $patch >stdout &&
1140 grep "RCPT TO:<bodies@example.com>" stdout &&
1141 grep "RCPT TO:<nobody@example.com>" stdout
1144 test_expect_success $PREREQ 'To headers from files reset each patch' '
1145 patch1=`git format-patch -1 --to="bodies@example.com"` &&
1146 patch2=`git format-patch -1 --to="other@example.com" HEAD~` &&
1147 test_when_finished "rm $patch1 && rm $patch2" &&
1148 git send-email \
1149 --dry-run \
1150 --from="Example <nobody@example.com>" \
1151 --to="nobody@example.com" \
1152 --smtp-server relay.example.com \
1153 $patch1 $patch2 >stdout &&
1154 test $(grep -c "RCPT TO:<bodies@example.com>" stdout) = 1 &&
1155 test $(grep -c "RCPT TO:<nobody@example.com>" stdout) = 2 &&
1156 test $(grep -c "RCPT TO:<other@example.com>" stdout) = 1
1159 test_expect_success $PREREQ 'setup expect' '
1160 cat >email-using-8bit <<EOF
1161 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
1162 Message-Id: <bogus-message-id@example.com>
1163 From: author@example.com
1164 Date: Sat, 12 Jun 2010 15:53:58 +0200
1165 Subject: subject goes here
1167 Dieser deutsche Text enthält einen Umlaut!
1171 test_expect_success $PREREQ 'setup expect' '
1172 cat >expected <<EOF
1173 Subject: subject goes here
1177 test_expect_success $PREREQ 'ASCII subject is not RFC2047 quoted' '
1178 clean_fake_sendmail &&
1179 echo bogus |
1180 git send-email --from=author@example.com --to=nobody@example.com \
1181 --smtp-server="$(pwd)/fake.sendmail" \
1182 --8bit-encoding=UTF-8 \
1183 email-using-8bit >stdout &&
1184 grep "Subject" msgtxt1 >actual &&
1185 test_cmp expected actual
1188 test_expect_success $PREREQ 'setup expect' '
1189 cat >content-type-decl <<EOF
1190 MIME-Version: 1.0
1191 Content-Type: text/plain; charset=UTF-8
1192 Content-Transfer-Encoding: 8bit
1196 test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '
1197 clean_fake_sendmail &&
1198 echo |
1199 git send-email --from=author@example.com --to=nobody@example.com \
1200 --smtp-server="$(pwd)/fake.sendmail" \
1201 email-using-8bit >stdout &&
1202 grep "do not declare a Content-Transfer-Encoding" stdout &&
1203 grep email-using-8bit stdout &&
1204 grep "Which 8bit encoding" stdout &&
1205 egrep "Content|MIME" msgtxt1 >actual &&
1206 test_cmp_text actual content-type-decl
1209 test_expect_success $PREREQ 'sendemail.8bitEncoding works' '
1210 clean_fake_sendmail &&
1211 git config sendemail.assume8bitEncoding UTF-8 &&
1212 echo bogus |
1213 git send-email --from=author@example.com --to=nobody@example.com \
1214 --smtp-server="$(pwd)/fake.sendmail" \
1215 email-using-8bit >stdout &&
1216 egrep "Content|MIME" msgtxt1 >actual &&
1217 test_cmp_text actual content-type-decl
1220 test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '
1221 clean_fake_sendmail &&
1222 git config sendemail.assume8bitEncoding "bogus too" &&
1223 echo bogus |
1224 git send-email --from=author@example.com --to=nobody@example.com \
1225 --smtp-server="$(pwd)/fake.sendmail" \
1226 --8bit-encoding=UTF-8 \
1227 email-using-8bit >stdout &&
1228 egrep "Content|MIME" msgtxt1 >actual &&
1229 test_cmp_text actual content-type-decl
1232 test_expect_success $PREREQ 'setup expect' '
1233 cat >email-using-8bit <<EOF
1234 From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001
1235 Message-Id: <bogus-message-id@example.com>
1236 From: author@example.com
1237 Date: Sat, 12 Jun 2010 15:53:58 +0200
1238 Subject: Dieser Betreff enthält auch einen Umlaut!
1240 Nothing to see here.
1244 test_expect_success $PREREQ 'setup expect' '
1245 cat >expected <<EOF
1246 Subject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=
1250 test_expect_success $PREREQ '--8bit-encoding also treats subject' '
1251 clean_fake_sendmail &&
1252 echo bogus |
1253 git send-email --from=author@example.com --to=nobody@example.com \
1254 --smtp-server="$(pwd)/fake.sendmail" \
1255 --8bit-encoding=UTF-8 \
1256 email-using-8bit >stdout &&
1257 grep "Subject" msgtxt1 >actual &&
1258 test_cmp_text expected actual
1261 # Note that the patches in this test are deliberately out of order; we
1262 # want to make sure it works even if the cover-letter is not in the
1263 # first mail.
1264 test_expect_success $PREREQ 'refusing to send cover letter template' '
1265 clean_fake_sendmail &&
1266 rm -fr outdir &&
1267 git format-patch --cover-letter -2 -o outdir &&
1268 test_must_fail git send-email \
1269 --from="Example <nobody@example.com>" \
1270 --to=nobody@example.com \
1271 --smtp-server="$(pwd)/fake.sendmail" \
1272 outdir/0002-*.patch \
1273 outdir/0000-*.patch \
1274 outdir/0001-*.patch \
1275 2>errors >out &&
1276 grep "SUBJECT HERE" errors &&
1277 test -z "$(ls msgtxt*)"
1280 test_expect_success $PREREQ '--force sends cover letter template anyway' '
1281 clean_fake_sendmail &&
1282 rm -fr outdir &&
1283 git format-patch --cover-letter -2 -o outdir &&
1284 git send-email \
1285 --force \
1286 --from="Example <nobody@example.com>" \
1287 --to=nobody@example.com \
1288 --smtp-server="$(pwd)/fake.sendmail" \
1289 outdir/0002-*.patch \
1290 outdir/0000-*.patch \
1291 outdir/0001-*.patch \
1292 2>errors >out &&
1293 ! grep "SUBJECT HERE" errors &&
1294 test -n "$(ls msgtxt*)"
1297 test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
1298 clean_fake_sendmail &&
1299 echo "alias sbd somebody@example.org" >.mailrc &&
1300 git config --replace-all sendemail.aliasesfile "$(pwd)/.mailrc" &&
1301 git config sendemail.aliasfiletype mailrc &&
1302 git send-email \
1303 --from="Example <nobody@example.com>" \
1304 --to=sbd \
1305 --smtp-server="$(pwd)/fake.sendmail" \
1306 outdir/0001-*.patch \
1307 2>errors >out &&
1308 grep "^!somebody@example\.org!$" commandline1
1311 test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
1312 clean_fake_sendmail &&
1313 echo "alias sbd someone@example.org" >~/.mailrc &&
1314 git config --replace-all sendemail.aliasesfile "~/.mailrc" &&
1315 git config sendemail.aliasfiletype mailrc &&
1316 git send-email \
1317 --from="Example <nobody@example.com>" \
1318 --to=sbd \
1319 --smtp-server="$(pwd)/fake.sendmail" \
1320 outdir/0001-*.patch \
1321 2>errors >out &&
1322 grep "^!someone@example\.org!$" commandline1
1325 test_done