Merge branch 'ta/remove-stale-translated-tut'
[gitweb.git] / t / t9001-send-email.sh
index 6c6af7d13f80bdc582e1d45558c24174a5800a38..97d6f4c7de57c54adfd5fed6401dbd168b5f3064 100755 (executable)
@@ -191,17 +191,44 @@ test_expect_success $PREREQ 'Show all headers' '
 
 test_expect_success $PREREQ 'Prompting works' '
        clean_fake_sendmail &&
-       (echo "Example <from@example.com>"
-        echo "to@example.com"
+       (echo "to@example.com"
         echo ""
        ) | GIT_SEND_EMAIL_NOTTY=1 git send-email \
                --smtp-server="$(pwd)/fake.sendmail" \
                $patches \
                2>errors &&
-               grep "^From: Example <from@example.com>\$" msgtxt1 &&
+               grep "^From: A U Thor <author@example.com>\$" msgtxt1 &&
                grep "^To: to@example.com\$" msgtxt1
 '
 
+test_expect_success $PREREQ,AUTOIDENT 'implicit ident is allowed' '
+       clean_fake_sendmail &&
+       (sane_unset GIT_AUTHOR_NAME &&
+       sane_unset GIT_AUTHOR_EMAIL &&
+       sane_unset GIT_COMMITTER_NAME &&
+       sane_unset GIT_COMMITTER_EMAIL &&
+       GIT_SEND_EMAIL_NOTTY=1 git send-email \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               --to=to@example.com \
+               $patches </dev/null 2>errors
+       )
+'
+
+test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email' '
+       clean_fake_sendmail &&
+       (sane_unset GIT_AUTHOR_NAME &&
+       sane_unset GIT_AUTHOR_EMAIL &&
+       sane_unset GIT_COMMITTER_NAME &&
+       sane_unset GIT_COMMITTER_EMAIL &&
+       GIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY &&
+       test_must_fail git send-email \
+               --smtp-server="$(pwd)/fake.sendmail" \
+               --to=to@example.com \
+               $patches </dev/null 2>errors &&
+       test_i18ngrep "tell me who you are" errors
+       )
+'
+
 test_expect_success $PREREQ 'tocmd works' '
        clean_fake_sendmail &&
        cp $patches tocmd.patch &&