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' '
45 test_expect_success 'dumb should prefer EDITOR to VISUAL' '
47 EDITOR=./e-EDITOR.sh &&
48 VISUAL=./e-VISUAL.sh &&
49 export EDITOR VISUAL &&
51 test "$(git show -s --format=%s)" = "Edited by EDITOR"
57 for i in vi EDITOR VISUAL core_editor GIT_EDITOR
59 echo "Edited by $i" >expect
60 unset EDITOR VISUAL GIT_EDITOR
61 git config --unset-all core.editor
64 git config core.editor ./e-core_editor.sh
71 test_expect_success "Using $i" '
72 git --exec-path=. commit --amend &&
73 git show -s --pretty=oneline |
74 sed -e "s/^[0-9a-f]* //" >actual &&
79 unset EDITOR VISUAL GIT_EDITOR
80 git config --unset-all core.editor
81 for i in vi EDITOR VISUAL core_editor GIT_EDITOR
83 echo "Edited by $i" >expect
86 git config core.editor ./e-core_editor.sh
93 test_expect_success "Using $i (override)" '
94 git --exec-path=. commit --amend &&
95 git show -s --pretty=oneline |
96 sed -e "s/^[0-9a-f]* //" >actual &&
101 if ! echo 'echo space > "$1"' > "e space.sh"
103 say "Skipping; FS does not support spaces in filenames"
107 test_expect_success 'editor with a space' '
109 chmod a+x "e space.sh" &&
110 GIT_EDITOR="./e\ space.sh" git commit --amend &&
111 test space = "$(git show -s --pretty=format:%s)"
116 test_expect_success 'core.editor with a space' '
118 git config core.editor \"./e\ space.sh\" &&
119 git commit --amend &&
120 test space = "$(git show -s --pretty=format:%s)"