Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> writes: > It's actually unlimited recursion if wildcards are active regardless > --max-depth > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > Regarding Junio's question earlier: > > > - Shouldn't "onelevel_only" be the same as limiting to a single depth > > with "max_depth"? > > Doing that would change the behavior of "git grep --max-depth=0 -- 'a*'" > from unlimited recursion currently to limited. We did not come to agree > how --max-depth should behave with wildcards last time it was discussed, > so it's best separating two flags (in the next patch) for now. Ok, I 100% agree with the "at least for now" reasoning. Thanks for digging into the archive. > Documentation/git-grep.txt | 3 +++ > tree-walk.c | 3 +++ > 2 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt > index 15d6711..6a8b1e3 100644 > --- a/Documentation/git-grep.txt > +++ b/Documentation/git-grep.txt > @@ -79,6 +79,9 @@ OPTIONS > --max-depth <depth>:: > For each <pathspec> given on command line, descend at most <depth> > levels of directories. A negative value means no limit. > + This option is ignored if <pathspec> contains active wildcards. > + In other words if "a*" matches a directory named "a*", > + "*" is matched literally so --max-depth is still effective. Do we have a definition of "active wildcard"? > diff --git a/tree-walk.c b/tree-walk.c > index f82dba6..492c7cd 100644 > --- a/tree-walk.c > +++ b/tree-walk.c > @@ -661,6 +661,9 @@ match_wildcards: > /* > * Match all directories. We'll try to match files > * later on. > + * max_depth is ignored but we may consider support it > + * in future, see > + * http://thread.gmane.org/gmane.comp.version-control.git/163757/focus=163840 > */ > if (ps->recursive && S_ISDIR(entry->mode)) > return entry_interesting; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html