t / t9001-send-email.shon commit Merge git://git.kernel.org/pub/scm/gitk/gitk (0825de8)
   1#!/bin/sh
   2
   3test_description='git-send-email'
   4. ./test-lib.sh
   5
   6PROG='git send-email'
   7test_expect_success \
   8    'prepare reference tree' \
   9    'echo "1A quick brown fox jumps over the" >file &&
  10     echo "lazy dog" >>file &&
  11     git add file
  12     GIT_AUTHOR_NAME="A" git commit -a -m "Initial."'
  13
  14test_expect_success \
  15    'Setup helper tool' \
  16    '(echo "#!/bin/sh"
  17      echo shift
  18      echo for a
  19      echo do
  20      echo "  echo \"!\$a!\""
  21      echo "done >commandline"
  22      echo "cat > msgtxt"
  23      ) >fake.sendmail
  24     chmod +x ./fake.sendmail
  25     git add fake.sendmail
  26     GIT_AUTHOR_NAME="A" git commit -a -m "Second."'
  27
  28test_expect_success \
  29    'Extract patches and send' \
  30    'git format-patch -n HEAD^1
  31     git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt'
  32
  33cat >expected <<\EOF
  34!nobody@example.com!
  35!author@example.com!
  36EOF
  37test_expect_success \
  38    'Verify commandline' \
  39    'diff commandline expected'
  40
  41test_done