Code

Merge branch 'jn/gitweb-log-history'
[git.git] / t / t7005-editor.sh
index c1cec553060a2fd6a4d27191a866b3bf53ba3335..b647957d75fa0d0ce4d88c7c3c7243f31af38b4a 100755 (executable)
@@ -4,11 +4,10 @@ test_description='GIT_EDITOR, core.editor, and stuff'
 
 . ./test-lib.sh
 
-OLD_TERM="$TERM"
-
 for i in GIT_EDITOR core_editor EDITOR VISUAL vi
 do
        cat >e-$i.sh <<-EOF
+       #!$SHELL_PATH
        echo "Edited by $i" >"\$1"
        EOF
        chmod +x e-$i.sh
@@ -89,6 +88,27 @@ do
        '
 done
 
-TERM="$OLD_TERM"
+if ! echo 'echo space > "$1"' > "e space.sh"
+then
+       say "Skipping; FS does not support spaces in filenames"
+       test_done
+fi
+
+test_expect_success 'editor with a space' '
+
+       chmod a+x "e space.sh" &&
+       GIT_EDITOR="./e\ space.sh" git commit --amend &&
+       test space = "$(git show -s --pretty=format:%s)"
+
+'
+
+unset GIT_EDITOR
+test_expect_success 'core.editor with a space' '
+
+       git config core.editor \"./e\ space.sh\" &&
+       git commit --amend &&
+       test space = "$(git show -s --pretty=format:%s)"
+
+'
 
 test_done