X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft7505-prepare-commit-msg-hook.sh;h=ff189624d48fb9f68997395d121d4e7056511245;hb=c216830f3828ae54c956a06fa6e4fdf212eecec1;hp=802aa624d0ff6a1add2e1c7e40a651336b450053;hpb=92798702cf6d201f80e257a07d0a0c40565c79fe;p=git.git diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh index 802aa624d..ff189624d 100755 --- a/t/t7505-prepare-commit-msg-hook.sh +++ b/t/t7505-prepare-commit-msg-hook.sh @@ -18,6 +18,9 @@ cat > fake-editor <<'EOF' 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 @@ -29,7 +32,7 @@ echo "#!$SHELL_PATH" > "$HOOK" cat >> "$HOOK" <<'EOF' if test "$2" = commit; then - source=$(git-rev-parse "$3") + source=$(git rev-parse "$3") else source=${2-default} fi @@ -58,7 +61,7 @@ test_expect_success 'with hook (-m editor)' ' echo "more" >> file && git add file && - GIT_EDITOR="$FAKE_EDITOR" git commit -e -m "more more" && + GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -m "more more" && test "`git log -1 --pretty=format:%s`" = message ' @@ -85,7 +88,7 @@ test_expect_success 'with hook (-F editor)' ' echo "more" >> file && git add file && - (echo more more | GIT_EDITOR="$FAKE_EDITOR" git commit -e -F -) && + (echo more more | GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -e -F -) && test "`git log -1 --pretty=format:%s`" = message ' @@ -104,7 +107,7 @@ test_expect_success 'with hook (editor)' ' echo "more more" >> file && git add file && - GIT_EDITOR="$FAKE_EDITOR" git commit && + GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit && test "`git log -1 --pretty=format:%s`" = default ' @@ -114,7 +117,7 @@ test_expect_success 'with hook (--amend)' ' head=`git rev-parse HEAD` && echo "more" >> file && git add file && - GIT_EDITOR="$FAKE_EDITOR" git commit --amend && + GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --amend && test "`git log -1 --pretty=format:%s`" = "$head" ' @@ -124,7 +127,7 @@ test_expect_success 'with hook (-c)' ' head=`git rev-parse HEAD` && echo "more" >> file && git add file && - GIT_EDITOR="$FAKE_EDITOR" git commit -c $head && + GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head && test "`git log -1 --pretty=format:%s`" = "$head" ' @@ -139,7 +142,7 @@ test_expect_success 'with failing hook' ' head=`git rev-parse HEAD` && echo "more" >> file && git add file && - ! GIT_EDITOR="$FAKE_EDITOR" git commit -c $head + ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head ' @@ -148,7 +151,7 @@ test_expect_success 'with failing hook (--no-verify)' ' head=`git rev-parse HEAD` && echo "more" >> file && git add file && - ! GIT_EDITOR="$FAKE_EDITOR" git commit --no-verify -c $head + ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit --no-verify -c $head '