Re: [PATCH v2 1/2] Document limited recursion pathspec matching with wildcards
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 15, 2012, 02:38 UTC
- Message-ID
- <7vfwfhwuzd.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1326533003-19686-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 14 quoted lines
> It's actually unlimited recursion if wildcards are active regardless > --max-depth > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > 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.
Show 15 quoted lines
> 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"?
Show 14 quoted lines
> 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;