summaryrefslogtreecommitdiff
path: root/t/t0061-run-command.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-12-03 10:05:07 +0900
committerJunio C Hamano <gitster@pobox.com>2018-12-03 10:05:07 +0900
commit89ba9a79ae3a4d828880cdcdc1b5f6aa92be662c (patch)
tree53941cc81a2ae58bd6a51e68d7d2425918cebfe9 /t/t0061-run-command.sh
parent321fd82389742398d2924640ce3a61791fd27d60 (diff)
downloadgit-89ba9a79ae3a4d828880cdcdc1b5f6aa92be662c.tar.gz
t0061: do not fail test if '.' is part of $PATH
t0061 creates a script with an unlikely name in the current directory and asks the run_command() API to run it without an explicit path, expecting that the script does *not* get run. This obviously would not work if the $PATH does contain such an element. Check if the running shell picks up the script without an explicit path to it, and skip the test when it does, as the run_command() API should also run the script in such an (insane) environment. Reported-by: "H.Merijn Brand" <h.m.brand@xs4all.nl> Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0061-run-command.sh')
-rwxr-xr-xt/t0061-run-command.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/t/t0061-run-command.sh b/t/t0061-run-command.sh
index 0303ddbb64..e622024cb2 100755
--- a/t/t0061-run-command.sh
+++ b/t/t0061-run-command.sh
@@ -30,7 +30,15 @@ test_expect_success 'run_command can run a command' '
test_cmp empty err
'
-test_expect_success 'run_command is restricted to PATH' '
+
+test_lazy_prereq RUNS_COMMANDS_FROM_PWD '
+ write_script runs-commands-from-pwd <<-\EOF &&
+ true
+ EOF
+ runs-commands-from-pwd >/dev/null 2>&1
+'
+
+test_expect_success !RUNS_COMMANDS_FROM_PWD 'run_command is restricted to PATH' '
write_script should-not-run <<-\EOF &&
echo yikes
EOF