t0008: 4 tests fail with ksh88
[gitweb.git] / t / t7810-grep.sh
index 028ffe4a05c066c112655822a351b64ed80f9c99..b540944408a6feb35f28ff7e18601db7a29f8635 100755 (executable)
@@ -791,12 +791,12 @@ test_expect_success 'outside of git repository' '
        } >non/expect.full &&
        echo file2:world >non/expect.sub &&
        (
-               GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
                export GIT_CEILING_DIRECTORIES &&
                cd non/git &&
                test_must_fail git grep o &&
                git grep --no-index o >../actual.full &&
-               test_cmp ../expect.full ../actual.full
+               test_cmp ../expect.full ../actual.full &&
                cd sub &&
                test_must_fail git grep o &&
                git grep --no-index o >../../actual.sub &&
@@ -805,7 +805,7 @@ test_expect_success 'outside of git repository' '
 
        echo ".*o*" >non/git/.gitignore &&
        (
-               GIT_CEILING_DIRECTORIES="$(pwd)/non/git" &&
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
                export GIT_CEILING_DIRECTORIES &&
                cd non/git &&
                test_must_fail git grep o &&
@@ -813,7 +813,7 @@ test_expect_success 'outside of git repository' '
                test_cmp ../expect.full ../actual.full &&
 
                {
-                       echo ".gitignore:.*o*"
+                       echo ".gitignore:.*o*" &&
                        cat ../expect.full
                } >../expect.with.ignored &&
                git grep --no-index --no-exclude o >../actual.full &&
@@ -821,6 +821,47 @@ test_expect_success 'outside of git repository' '
        )
 '
 
+test_expect_success 'outside of git repository with fallbackToNoIndex' '
+       rm -fr non &&
+       mkdir -p non/git/sub &&
+       echo hello >non/git/file1 &&
+       echo world >non/git/sub/file2 &&
+       cat <<-\EOF >non/expect.full &&
+       file1:hello
+       sub/file2:world
+       EOF
+       echo file2:world >non/expect.sub &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
+               git -c grep.fallbackToNoIndex=true grep o >../actual.full &&
+               test_cmp ../expect.full ../actual.full &&
+               cd sub &&
+               test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
+               git -c grep.fallbackToNoIndex=true grep o >../../actual.sub &&
+               test_cmp ../../expect.sub ../../actual.sub
+       ) &&
+
+       echo ".*o*" >non/git/.gitignore &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
+               git -c grep.fallbackToNoIndex=true grep --exclude-standard o >../actual.full &&
+               test_cmp ../expect.full ../actual.full &&
+
+               {
+                       echo ".gitignore:.*o*" &&
+                       cat ../expect.full
+               } >../expect.with.ignored &&
+               git -c grep.fallbackToNoIndex grep --no-exclude o >../actual.full &&
+               test_cmp ../expect.with.ignored ../actual.full
+       )
+'
+
 test_expect_success 'inside git repository but with --no-index' '
        rm -fr is &&
        mkdir -p is/git/sub &&