grep: do not unnecessarily query repo for "--"
[gitweb.git] / t / t7810-grep.sh
index 19f0108f8a2c67c518a92d996be7a335dbb69af2..2c1f7373e6bce9497a45894133757f58a3e084af 100755 (executable)
@@ -982,6 +982,21 @@ test_expect_success 'grep -e -- -- path' '
        test_cmp expected actual
 '
 
+test_expect_success 'grep --no-index pattern -- path' '
+       rm -fr non &&
+       mkdir -p non/git &&
+       (
+               GIT_CEILING_DIRECTORIES="$(pwd)/non" &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non/git &&
+               echo hello >hello &&
+               echo goodbye >goodbye &&
+               echo hello:hello >expect &&
+               git grep --no-index o -- hello >actual &&
+               test_cmp expect actual
+       )
+'
+
 cat >expected <<EOF
 hello.c:int main(int argc, const char **argv)
 hello.c:       printf("Hello world.\n");