git-send-email.perl: Handle shell metacharacters in $EDITOR properly
[gitweb.git] / t / t9001-send-email.sh
index cbbfa9cb4986403cb214bba6c2216c85471469c9..030f66cb7c35a3d7808a998512603726937acd19 100755 (executable)
@@ -81,7 +81,7 @@ test_expect_success 'Show all headers' '
                -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
                -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
                >actual-show-all-headers &&
-       diff -u expected-show-all-headers actual-show-all-headers
+       test_cmp expected-show-all-headers actual-show-all-headers
 '
 
 z8=zzzzzzzz
@@ -139,15 +139,19 @@ test_expect_success 'Valid In-Reply-To when prompting' '
 
 test_expect_success 'setup fake editor' '
        (echo "#!/bin/sh" &&
-        echo "echo fake edit >>\$1"
+        echo "echo fake edit >>\"\$1\""
        ) >fake-editor &&
        chmod +x fake-editor
 '
 
+FAKE_EDITOR="$(pwd)/fake-editor"
+export FAKE_EDITOR
+GIT_EDITOR='"$FAKE_EDITOR"'
+export GIT_EDITOR
+
 test_expect_success '--compose works' '
        clean_fake_sendmail &&
        echo y | \
-               GIT_EDITOR=$(pwd)/fake-editor \
                GIT_SEND_EMAIL_NOTTY=1 \
                git send-email \
                --compose --subject foo \