Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / git / t / t9001-send-email.sh
blobd58fccb5220b6c2182563433ea0cc1ab47dfa596
1 #!/bin/sh
3 test_description='git-send-email'
4 . ./test-lib.sh
6 say "cannot invoke fake.sendmail; skipping test"
7 test_done
8 exit 0
10 PROG='git send-email'
11 test_expect_success \
12 'prepare reference tree' \
13 'echo "1A quick brown fox jumps over the" >file &&
14 echo "lazy dog" >>file &&
15 git add file
16 GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
18 test_expect_success \
19 'Setup helper tool' \
20 '(echo "#!/bin/sh"
21 echo shift
22 echo for a
23 echo do
24 echo " echo \"!\$a!\""
25 echo "done >commandline"
26 echo "cat > msgtxt"
27 ) >fake.sendmail
28 chmod +x ./fake.sendmail
29 git add fake.sendmail
30 GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
32 test_expect_success 'Extract patches' '
33 patches=`git format-patch -n HEAD^1`
36 test_expect_success 'Send patches' '
37 git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
40 cat >expected <<\EOF
41 !nobody@example.com!
42 !author@example.com!
43 EOF
44 test_expect_success \
45 'Verify commandline' \
46 'diff commandline expected'
48 test_done