3 test_description
='GIT_EDITOR, core.editor, and stuff'
7 for i
in GIT_EDITOR core_editor EDITOR VISUAL vi
11 echo "Edited by $i" >"\$1"
17 unset EDITOR VISUAL GIT_EDITOR
19 test_expect_success setup
'
22 echo "$msg" >expect &&
25 git commit -m "$msg" &&
26 git show -s --pretty=oneline |
27 sed -e "s/^[0-9a-f]* //" >actual &&
34 test_expect_success
'dumb should error out when falling back on vi' '
47 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
49 echo "Edited by $i" >expect
50 unset EDITOR VISUAL GIT_EDITOR
51 git config
--unset-all core.editor
54 git config core.editor .
/e-core_editor.sh
61 test_expect_success
"Using $i" '
62 git --exec-path=. commit --amend &&
63 git show -s --pretty=oneline |
64 sed -e "s/^[0-9a-f]* //" >actual &&
69 unset EDITOR VISUAL GIT_EDITOR
70 git config
--unset-all core.editor
71 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
73 echo "Edited by $i" >expect
76 git config core.editor .
/e-core_editor.sh
83 test_expect_success
"Using $i (override)" '
84 git --exec-path=. commit --amend &&
85 git show -s --pretty=oneline |
86 sed -e "s/^[0-9a-f]* //" >actual &&
91 test_expect_success
'editor with a space' '
93 if echo "echo space > \"\$1\"" > "e space.sh"
95 chmod a+x "e space.sh" &&
96 GIT_EDITOR="./e\ space.sh" git commit --amend &&
97 test space = "$(git show -s --pretty=format:%s)"
99 say "Skipping; FS does not support spaces in filenames"
105 test_expect_success
'core.editor with a space' '
107 if test -f "e space.sh"
109 git config core.editor \"./e\ space.sh\" &&
110 git commit --amend &&
111 test space = "$(git show -s --pretty=format:%s)"
113 say "Skipping; FS does not support spaces in filenames"