@@ -791,12 +791,12 @@ test_expect_success 'outside of git repository' '
791
791
} >non/expect.full &&
792
792
echo file2:world >non/expect.sub &&
793
793
(
794
- GIT_CEILING_DIRECTORIES="$(pwd)/non/git " &&
794
+ GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
795
795
export GIT_CEILING_DIRECTORIES &&
796
796
cd non/git &&
797
797
test_must_fail git grep o &&
798
798
git grep --no-index o >../actual.full &&
799
- test_cmp ../expect.full ../actual.full
799
+ test_cmp ../expect.full ../actual.full &&
800
800
cd sub &&
801
801
test_must_fail git grep o &&
802
802
git grep --no-index o >../../actual.sub &&
@@ -805,22 +805,63 @@ test_expect_success 'outside of git repository' '
805
805
806
806
echo ".*o*" >non/git/.gitignore &&
807
807
(
808
- GIT_CEILING_DIRECTORIES="$(pwd)/non/git " &&
808
+ GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
809
809
export GIT_CEILING_DIRECTORIES &&
810
810
cd non/git &&
811
811
test_must_fail git grep o &&
812
812
git grep --no-index --exclude-standard o >../actual.full &&
813
813
test_cmp ../expect.full ../actual.full &&
814
814
815
815
{
816
- echo ".gitignore:.*o*"
816
+ echo ".gitignore:.*o*" &&
817
817
cat ../expect.full
818
818
} >../expect.with.ignored &&
819
819
git grep --no-index --no-exclude o >../actual.full &&
820
820
test_cmp ../expect.with.ignored ../actual.full
821
821
)
822
822
'
823
823
824
+ test_expect_success ' outside of git repository with fallbackToNoIndex' '
825
+ rm -fr non &&
826
+ mkdir -p non/git/sub &&
827
+ echo hello >non/git/file1 &&
828
+ echo world >non/git/sub/file2 &&
829
+ cat <<-\EOF >non/expect.full &&
830
+ file1:hello
831
+ sub/file2:world
832
+ EOF
833
+ echo file2:world >non/expect.sub &&
834
+ (
835
+ GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
836
+ export GIT_CEILING_DIRECTORIES &&
837
+ cd non/git &&
838
+ test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
839
+ git -c grep.fallbackToNoIndex=true grep o >../actual.full &&
840
+ test_cmp ../expect.full ../actual.full &&
841
+ cd sub &&
842
+ test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
843
+ git -c grep.fallbackToNoIndex=true grep o >../../actual.sub &&
844
+ test_cmp ../../expect.sub ../../actual.sub
845
+ ) &&
846
+
847
+ echo ".*o*" >non/git/.gitignore &&
848
+ (
849
+ GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
850
+ export GIT_CEILING_DIRECTORIES &&
851
+ cd non/git &&
852
+ test_must_fail git -c grep.fallbackToNoIndex=false grep o &&
853
+ git -c grep.fallbackToNoIndex=true grep --exclude-standard o >../actual.full &&
854
+ test_cmp ../expect.full ../actual.full &&
855
+
856
+ {
857
+ echo ".gitignore:.*o*" &&
858
+ cat ../expect.full
859
+ } >../expect.with.ignored &&
860
+ git -c grep.fallbackToNoIndex grep --no-exclude o >../actual.full &&
861
+ test_cmp ../expect.with.ignored ../actual.full
862
+ )
863
+ '
864
+
824
865
test_expect_success ' inside git repository but with --no-index' '
825
866
rm -fr is &&
826
867
mkdir -p is/git/sub &&
0 commit comments