Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Wyckoff <pw@padd.com>2014-01-22 03:16:44 +0400
committerJunio C Hamano <gitster@pobox.com>2014-01-22 20:06:19 +0400
commit0cf1b72a38e6190a7e614bbc53fbb81704a3d4af (patch)
treeb9cc9161d83b70a11387bd0691ddfc7b3928c30f /t/t9805-git-p4-skip-submit-edit.sh
parent0055b56e10f77b1b5f5521b8ba3614f962a09288 (diff)
git p4 test: do not pollute /tmp
Generating the submit template for p4 uses tempfile.mkstemp(), which by default puts files in /tmp. For a test that fails, possibly on purpose, this is not cleaned up. Run with TMPDIR pointing into the trash directory so the temp files go away with the test results. To do this required some other minor changes. First, the editor is launched using system(editor + " " + template_file), using shell expansion to build the command string. This doesn't work if editor has a space in it. And is generally unwise as it's easy to fool the shell into doing extra work. Exec the args directly, without shell expansion. Second, without shell expansion, the trick of "P4EDITOR=:" used in the tests doesn't work. Use a real command, true, as the non-interactive editor for testing. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9805-git-p4-skip-submit-edit.sh')
-rwxr-xr-xt/t9805-git-p4-skip-submit-edit.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh
index ff2cc79701..89311886db 100755
--- a/t/t9805-git-p4-skip-submit-edit.sh
+++ b/t/t9805-git-p4-skip-submit-edit.sh
@@ -17,7 +17,7 @@ test_expect_success 'init depot' '
)
'
-# this works because EDITOR is set to :
+# this works because P4EDITOR is set to true
test_expect_success 'no config, unedited, say yes' '
git p4 clone --dest="$git" //depot &&
test_when_finished cleanup_git &&
@@ -90,7 +90,9 @@ test_expect_success 'no config, edited' '
cd "$git" &&
echo line >>file1 &&
git commit -a -m "change 5" &&
- P4EDITOR="" EDITOR="\"$TRASH_DIRECTORY/ed.sh\"" git p4 submit &&
+ P4EDITOR="$TRASH_DIRECTORY/ed.sh" &&
+ export P4EDITOR &&
+ git p4 submit &&
p4 changes //depot/... >wc &&
test_line_count = 5 wc
)