summaryrefslogtreecommitdiff
path: root/t/t7005-editor.sh
AgeCommit message (Collapse)AuthorFilesLines
2018-09-28t7005-editor: quote filename to fix whitespace-issueLibravatar Alexander Pyhalov1-1/+1
Commit 4362da078e (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 <apyhalov@gmail.com> Commit-message-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-15t7005-editor: get rid of the SPACES_IN_FILENAMES prereqLibravatar SZEDER Gábor1-9/+3
The last two tests 'editor with a space' and 'core.editor with a space' in 't7005-editor.sh' need the SPACES_IN_FILENAMES prereq to ensure that they are only run on filesystems that allow, well, spaces in filenames. However, we have been putting a space in the name of the trash directory for just over a decade now, so we wouldn't be able to run any of our tests on such a filesystem in the first place. This prereq is therefore unnecessary, remove it. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-07tests: fix diff order arguments in test_cmpLibravatar Stefan Beller1-3/+3
Fix the argument order for test_cmp. When given the expected result first the diff shows the actual output with '+' and the expectation with '-', which is the convention for our tests. Signed-off-by: Stefan Beller <sbeller@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18t/t7005-editor: change from skip_all=* to prereq skipLibravatar Ævar Arnfjörð Bjarmason1-5/+5
Change this test to skip test with test prerequisites, and to do setup work in tests. This improves the skipped statistics on platforms where the test isn't run. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-08tests: Use skip_all=* to skip testsLibravatar Ævar Arnfjörð Bjarmason1-1/+1
Change tests to skip with skip_all=* + test_done instead of using say + test_done. This is a follow-up to "tests: Skip tests in a way that makes sense under TAP" (fadb5156e4). I missed these cases when prepearing that patch, hopefully this is all of them. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-22Merge branch 'maint'Libravatar Junio C Hamano1-1/+1
* maint: Update draft release notes to 1.7.1.1 tests: remove unnecessary '^' from 'expr' regular expression Conflicts: diff.c
2010-06-21tests: remove unnecessary '^' from 'expr' regular expressionLibravatar Junio C Hamano1-1/+1
As Brandon noticed, a regular expression match given to 'expr' is already anchored at the beginning. Some versions of expr even complain about this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-31tests: use "test_cmp", not "diff", when verifying the resultLibravatar Gary V. Vaughan1-3/+3
In tests, call test_cmp rather than raw diff where possible (i.e. if the output does not go to a pipe), to allow the use of, say, 'cmp' when the default 'diff -u' is not compatible with a vendor diff. When that is not possible, use $DIFF, as set in GIT-BUILD-OPTIONS. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13Provide a build time default-editor settingLibravatar Jonathan Nieder1-12/+25
Provide a DEFAULT_EDITOR knob to allow setting the fallback editor to use instead of vi (when VISUAL, EDITOR, and GIT_EDITOR are unset). The value can be set at build time according to a system’s policy. For example, on Debian systems, the default editor should be the 'editor' command. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-11-13Do not use VISUAL editor on dumb terminalsLibravatar Jonathan Nieder1-0/+10
Refuse to use $VISUAL and fall back to $EDITOR if TERM is unset or set to "dumb". Traditionally, VISUAL is set to a screen editor and EDITOR to a line-based editor, which should be more useful in that situation. vim, for example, is happy to assume a terminal supports ANSI sequences even if TERM is dumb (e.g., when running from a text editor like Acme). git already refuses to fall back to vi on a dumb terminal if GIT_EDITOR, core.editor, VISUAL, and EDITOR are unset, but without this patch, that check is suppressed by VISUAL=vi. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05tests: remove exit after test_done callLibravatar Jeff King1-1/+0
test_done always exits, so this line is never executed. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-03-25t7005-editor: Use $SHELL_PATH in the editor scriptsLibravatar Johannes Sixt1-0/+1
The test sets up various shell scripts and uses them as commit message editors. On Windows, we need a shebang line in order to recognize the files as executable shell scripts. This adds it. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2009-03-19Call 'say' outside test_expect_successLibravatar Johannes Sixt1-16/+13
There were some uses of 'say' inside test_expect_success. But if the tests were not run in verbose mode, this message went to /dev/null. Pull them out of test_expect_success. Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2008-04-06test suite: remove useless TERM cruft in "t7005-editor.sh"Libravatar Christian Couder1-4/+0
In commit 15387e3 (Test suite: reset TERM to its previous value after testing., 2007-10-26), I added a workaround to reset TERM to its previous value before the "test_done" at the end of "t7005-editor.sh" because otherwise "test_done" would have printed the test result with a bad TERM env variable (this resulted in output with no color on konsole). But since commit c2116a1 (test-lib: fix TERM to dumb for test repeatability, 2008-03-06), colored output is printed in a subshell with TERM reset to its original value so the earlier workaround is not needed anymore. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-11launch_editor(): allow spaces in the filenameLibravatar Johannes Schindelin1-0/+27
The construct sh -c "$0 \"$@\"" <editor> <file> does not pick up quotes in <editor>, so you cannot give path to the editor that has a shell IFS whitespace in it, and also give it initial set of parameters and flags. Replace $0 with <editor> to fix this issue. This fixes git config core.editor '"c:/Program Files/What/Ever.exe"' In other words, you can specify an editor with spaces in its path using a config containing something like this: [core] editor = \"c:/Program Files/Darn/Spaces.exe\" NOTE: we cannot just replace the $0 with \"$0\", because we still want this to work: [core] editor = emacs -nw Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-22t7005: do not exit inside test.Libravatar Junio C Hamano1-1/+1
The way to signal failure is to leave non-zero in $?, not abort the entire test. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14Merge branch 'bs/maint-t7005'Libravatar Junio C Hamano1-3/+2
* bs/maint-t7005: t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH
2007-11-11t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATHLibravatar Björn Steinbrink1-3/+2
The git wrapper executable always prepends the GIT_EXEC_PATH build variable to the current PATH, so prepending "." to the PATH is not enough to give precedence to the fake vi executable. The --exec-path option allows to prepend a directory to PATH even before GIT_EXEC_PATH (which is added anyway), so we can use that instead. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-26Test suite: reset TERM to its previous value after testing.Libravatar Christian Couder1-0/+4
Using konsole, I get no colored output at the end of "t7005-editor.sh" without this patch. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-20Add GIT_EDITOR environment and core.editor configuration variablesLibravatar Adam Roben1-0/+91
These variables let you specify an editor that will be launched in preference to the EDITOR and VISUAL environment variables. The order of preference is GIT_EDITOR, core.editor, EDITOR, VISUAL. [jc: added a test and config variable documentation] Signed-off-by: Adam Roben <aroben@apple.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>