aboutsummaryrefslogtreecommitdiff
path: root/t/t9001-send-email.sh
diff options
context:
space:
mode:
authorBryan Donlan <bdonlan@fushizen.net>2008-05-04 01:37:53 -0400
committerJunio C Hamano <gitster@pobox.com>2008-05-05 14:17:00 -0700
commit065096c2b558af80e670299621ff3ddc6839954c (patch)
tree0ee3405c9bdb02277c527efd7a6b4b29594b898c /t/t9001-send-email.sh
parente5c349ba112fc53832c757cef122297718d3a175 (diff)
downloadgit-065096c2b558af80e670299621ff3ddc6839954c.tar.gz
git-065096c2b558af80e670299621ff3ddc6839954c.tar.xz
git-send-email.perl: Handle shell metacharacters in $EDITOR properly
This fixes the git-send-perl semantics for launching an editor when $GIT_EDITOR (or friends) contains shell metacharacters to match launch_editor() in builtin-tag.c. If we use the current approach (sh -c '$0 $@' "$EDITOR" files ...), we see it fails when $EDITOR has shell metacharacters: $ sh -x -c '$0 $@' "$VISUAL" "foo" + "$FAKE_EDITOR" foo "$FAKE_EDITOR": 1: "$FAKE_EDITOR": not found Whereas builtin-tag.c will invoke sh -c "$EDITOR \"$@\"". Thus, this patch changes git-send-email.perl to use the same method as the C utilities, and additionally updates t/t9001-send-email.sh to test for this bug. Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-xt/t9001-send-email.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4e6..030f66cb7 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -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 \