aboutsummaryrefslogtreecommitdiff
path: root/t/t7504-commit-msg-hook.sh
diff options
context:
space:
mode:
authorBryan Donlan <bdonlan@fushizen.net>2008-05-04 01:37:59 -0400
committerJunio C Hamano <gitster@pobox.com>2008-05-05 14:37:02 -0700
commitf69e836fab2b634281d92a0d304de4d768e479cc (patch)
treeebd3e28ff26f0077846085d5c86970cc5ee05759 /t/t7504-commit-msg-hook.sh
parent0e46e704626af5189c9c9ff2c0f348d2205c10f3 (diff)
downloadgit-f69e836fab2b634281d92a0d304de4d768e479cc.tar.gz
git-f69e836fab2b634281d92a0d304de4d768e479cc.tar.xz
Fix tests breaking when checkout path contains shell metacharacters
This fixes the remainder of the issues where the test script itself is at fault for failing when the git checkout path contains whitespace or other shell metacharacters. The majority of git svn tests used the idiom test_expect_success "title" "test script using $svnrepo" These were changed to have the test script in single-quotes: test_expect_success "title" 'test script using "$svnrepo"' which unfortunately makes the patch appear larger than it really is. One consequence of this change is that in the verbose test output the value of $svnrepo (and in some cases other variables, too) is no longer expanded, i.e. previously we saw * expecting success: test script using /path/to/git/t/trash/svnrepo but now it is: * expecting success: test script using "$svnrepo" Signed-off-by: Bryan Donlan <bdonlan@fushizen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7504-commit-msg-hook.sh')
-rwxr-xr-xt/t7504-commit-msg-hook.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh
index eff36aaee..88577af95 100755
--- a/t/t7504-commit-msg-hook.sh
+++ b/t/t7504-commit-msg-hook.sh
@@ -19,6 +19,9 @@ cp FAKE_MSG "$1"
exit 0
EOF
chmod +x fake-editor
+
+## Not using test_set_editor here so we can easily ensure the editor variable
+## is only set for the editor tests
FAKE_EDITOR="$(pwd)/fake-editor"
export FAKE_EDITOR
@@ -27,7 +30,7 @@ test_expect_success 'with no hook (editor)' '
echo "more foo" >> file &&
git add file &&
echo "more foo" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit
'
@@ -44,7 +47,7 @@ test_expect_success '--no-verify with no hook (editor)' '
echo "more bar" > file &&
git add file &&
echo "more bar" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify
'
@@ -71,7 +74,7 @@ test_expect_success 'with succeeding hook (editor)' '
echo "more more" >> file &&
git add file &&
echo "more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit
'
@@ -88,7 +91,7 @@ test_expect_success '--no-verify with succeeding hook (editor)' '
echo "even more more" >> file &&
git add file &&
echo "even more more" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify
'
@@ -111,7 +114,7 @@ test_expect_success 'with failing hook (editor)' '
echo "more another" >> file &&
git add file &&
echo "more another" > FAKE_MSG &&
- ! (GIT_EDITOR="$FAKE_EDITOR" git commit)
+ ! (GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit)
'
@@ -128,7 +131,7 @@ test_expect_success '--no-verify with failing hook (editor)' '
echo "more stuff" >> file &&
git add file &&
echo "more stuff" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify
'
@@ -146,7 +149,7 @@ test_expect_success 'with non-executable hook (editor)' '
echo "content again" >> file &&
git add file &&
echo "content again" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit -m "content again"
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -m "content again"
'
@@ -163,7 +166,7 @@ test_expect_success '--no-verify with non-executable hook (editor)' '
echo "even more content" >> file &&
git add file &&
echo "even more content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify
'
@@ -193,7 +196,7 @@ test_expect_success 'hook edits commit message (editor)' '
echo "additional content" >> file &&
git add file &&
echo "additional content" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit &&
commit_msg_is "new message"
'
@@ -212,7 +215,7 @@ test_expect_success "hook doesn't edit commit message (editor)" '
echo "more plus" >> file &&
git add file &&
echo "more plus" > FAKE_MSG &&
- GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify &&
+ GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify &&
commit_msg_is "more plus"
'