add: convert to use parse_pathspec
[gitweb.git] / builtin / grep.c
index 1a6c02804c7f027b1da668f25b948f0d3e951519..4bc075422e3c17e7666ed90e4a35be020586be49 100644 (file)
@@ -858,7 +858,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        }
 
        parse_pathspec(&pathspec, 0,
-                      PATHSPEC_PREFER_CWD,
+                      PATHSPEC_PREFER_CWD |
+                      (opt.max_depth != -1 ? PATHSPEC_MAXDEPTH_VALID : 0),
                       prefix, argv + i);
        pathspec.max_depth = opt.max_depth;
        pathspec.recursive = 1;