Skip to content

Commit b1492bf

Browse files
pyhalovgitster
authored andcommitted
t7005-editor: quote filename to fix whitespace-issue
Commit 4362da0 (t7005-editor: get rid of the SPACES_IN_FILENAMES prereq, 2018-05-14) removed code for detecting whether spaces in filenames work. Since we rely on spaces throughout the test suite ("trash directory.t1234-foo"), testing whether we can use the filename "e space.sh" was redundant and unnecessary. In simplifying the code, though, this introduced a regression around how spaces are handled, not in the /name/ of the editor script, but /in/ the script itself. The script just does `echo space >$1`, where $1 is for example "/foo/t/trash directory.t7005-editor/.git/COMMIT_EDITMSG". With most shells, or with Bash in posix mode, $1 will not be subjected to field splitting. But if we invoke Bash directly, which will happen if we build Git with SHELL_PATH=/bin/bash, it will detect and complain about an "ambiguous redirect". More details can be found in [1], thanks to SZEDER Gábor. Make sure that the editor script quotes "$1" to remove the ambiguity. [1] https://public-inbox.org/git/20180926121107.GH27036@localhost/ Signed-off-by: Alexander Pyhalov <[email protected]> Commit-message-by: Martin Ågren <[email protected]> Signed-off-by: Martin Ågren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53f9a3e commit b1492bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t7005-editor.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ do
112112
done
113113

114114
test_expect_success 'editor with a space' '
115-
echo "echo space >\$1" >"e space.sh" &&
115+
echo "echo space >\"\$1\"" >"e space.sh" &&
116116
chmod a+x "e space.sh" &&
117117
GIT_EDITOR="./e\ space.sh" git commit --amend &&
118118
test space = "$(git show -s --pretty=format:%s)"

0 commit comments

Comments
 (0)