Imported Upstream version 2.21.0
[platform/upstream/git.git] / t / t0061-run-command.sh
index cf932c8..ebc4956 100755 (executable)
@@ -13,11 +13,13 @@ cat >hello-script <<-EOF
 EOF
 
 test_expect_success 'start_command reports ENOENT (slash)' '
-       test-tool run-command start-command-ENOENT ./does-not-exist
+       test-tool run-command start-command-ENOENT ./does-not-exist 2>err &&
+       test_i18ngrep "\./does-not-exist" err
 '
 
 test_expect_success 'start_command reports ENOENT (no slash)' '
-       test-tool run-command start-command-ENOENT does-not-exist
+       test-tool run-command start-command-ENOENT does-not-exist 2>err &&
+       test_i18ngrep "does-not-exist" err
 '
 
 test_expect_success 'run_command can run a command' '
@@ -29,11 +31,20 @@ test_expect_success 'run_command can run a command' '
        test_must_be_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
-       test_must_fail test-tool run-command run-command should-not-run
+       test_must_fail test-tool run-command run-command should-not-run 2>err &&
+       test_i18ngrep "should-not-run" err
 '
 
 test_expect_success !MINGW 'run_command can run a script without a #! line' '
@@ -155,7 +166,8 @@ test_trace () {
        expect="$1"
        shift
        GIT_TRACE=1 test-tool run-command "$@" run-command true 2>&1 >/dev/null | \
-               sed -e 's/.* run_command: //' -e '/trace: .*/d' >actual &&
+               sed -e 's/.* run_command: //' -e '/trace: .*/d' \
+                       -e '/RUNTIME_PREFIX requested/d' >actual &&
        echo "$expect true" >expect &&
        test_cmp expect actual
 }
@@ -188,4 +200,14 @@ test_expect_success 'GIT_TRACE with environment variables' '
        )
 '
 
+test_expect_success MINGW 'verify curlies are quoted properly' '
+       : force the rev-parse through the MSYS2 Bash &&
+       git -c alias.r="!git rev-parse" r -- a{b}c >actual &&
+       cat >expect <<-\EOF &&
+       --
+       a{b}c
+       EOF
+       test_cmp expect actual
+'
+
 test_done