3 test_description
='GIT_EDITOR, core.editor, and stuff'
9 for i
in GIT_EDITOR core_editor EDITOR VISUAL vi
12 echo "Edited by $i" >"\$1"
18 unset EDITOR VISUAL GIT_EDITOR
20 test_expect_success setup
'
23 echo "$msg" >expect &&
26 git commit -m "$msg" &&
27 git show -s --pretty=oneline |
28 sed -e "s/^[0-9a-f]* //" >actual &&
35 test_expect_success
'dumb should error out when falling back on vi' '
48 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
50 echo "Edited by $i" >expect
51 unset EDITOR VISUAL GIT_EDITOR
52 git config
--unset-all core.editor
55 git config core.editor .
/e-core_editor.sh
62 test_expect_success
"Using $i" '
63 git --exec-path=. commit --amend &&
64 git show -s --pretty=oneline |
65 sed -e "s/^[0-9a-f]* //" >actual &&
70 unset EDITOR VISUAL GIT_EDITOR
71 git config
--unset-all core.editor
72 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
74 echo "Edited by $i" >expect
77 git config core.editor .
/e-core_editor.sh
84 test_expect_success
"Using $i (override)" '
85 git --exec-path=. commit --amend &&
86 git show -s --pretty=oneline |
87 sed -e "s/^[0-9a-f]* //" >actual &&
92 test_expect_success
'editor with a space' '
94 if echo "echo space > \"\$1\"" > "e space.sh"
96 chmod a+x "e space.sh" &&
97 GIT_EDITOR="./e\ space.sh" git commit --amend &&
98 test space = "$(git show -s --pretty=format:%s)"
100 say "Skipping; FS does not support spaces in filenames"
106 test_expect_success
'core.editor with a space' '
108 if test -f "e space.sh"
110 git config core.editor \"./e\ space.sh\" &&
111 git commit --amend &&
112 test space = "$(git show -s --pretty=format:%s)"
114 say "Skipping; FS does not support spaces in filenames"