diff options
Diffstat (limited to 't/t7504-commit-msg-hook.sh')
| -rwxr-xr-x | t/t7504-commit-msg-hook.sh | 23 | 
1 files changed, 13 insertions, 10 deletions
| diff --git a/t/t7504-commit-msg-hook.sh b/t/t7504-commit-msg-hook.sh index eff36aaee3..88577af953 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"  ' | 
