3 test_description
='GIT_EDITOR, core.editor, and stuff'
7 for i
in GIT_EDITOR core_editor EDITOR VISUAL vi
10 echo "Edited by $i" >"\$1"
16 unset EDITOR VISUAL GIT_EDITOR
18 test_expect_success setup
'
21 echo "$msg" >expect &&
24 git commit -m "$msg" &&
25 git show -s --pretty=oneline |
26 sed -e "s/^[0-9a-f]* //" >actual &&
33 test_expect_success
'dumb should error out when falling back on vi' '
46 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
48 echo "Edited by $i" >expect
49 unset EDITOR VISUAL GIT_EDITOR
50 git config
--unset-all core.editor
53 git config core.editor .
/e-core_editor.sh
60 test_expect_success
"Using $i" '
61 git --exec-path=. commit --amend &&
62 git show -s --pretty=oneline |
63 sed -e "s/^[0-9a-f]* //" >actual &&
68 unset EDITOR VISUAL GIT_EDITOR
69 git config
--unset-all core.editor
70 for i
in vi EDITOR VISUAL core_editor GIT_EDITOR
72 echo "Edited by $i" >expect
75 git config core.editor .
/e-core_editor.sh
82 test_expect_success
"Using $i (override)" '
83 git --exec-path=. commit --amend &&
84 git show -s --pretty=oneline |
85 sed -e "s/^[0-9a-f]* //" >actual &&
90 test_expect_success
'editor with a space' '
92 if echo "echo space > \"\$1\"" > "e space.sh"
94 chmod a+x "e space.sh" &&
95 GIT_EDITOR="./e\ space.sh" git commit --amend &&
96 test space = "$(git show -s --pretty=format:%s)"
98 say "Skipping; FS does not support spaces in filenames"
104 test_expect_success
'core.editor with a space' '
106 if test -f "e space.sh"
108 git config core.editor \"./e\ space.sh\" &&
109 git commit --amend &&
110 test space = "$(git show -s --pretty=format:%s)"
112 say "Skipping; FS does not support spaces in filenames"