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 if ! echo 'echo space > "$1"' > "e space.sh"
93 say
"Skipping; FS does not support spaces in filenames"
97 test_expect_success
'editor with a space' '
99 chmod a+x "e space.sh" &&
100 GIT_EDITOR="./e\ space.sh" git commit --amend &&
101 test space = "$(git show -s --pretty=format:%s)"
106 test_expect_success
'core.editor with a space' '
108 git config core.editor \"./e\ space.sh\" &&
109 git commit --amend &&
110 test space = "$(git show -s --pretty=format:%s)"