From: Michał Kiedrowicz Date: Fri, 10 Jul 2009 16:41:19 GMT Subject: Re: [PATCH/RFC] grep: Add --directories option. Message-ID: <20090710184119.072e5a0f@gmail.com> In-Reply-To: <4A56EED7.9040008@lsrfire.ath.cx> Hi, René Scharfe wrote: > > I suspect the patch would shrink significantly if you moved "int > recurse" into struct grep_opt, because then you wouln't need to add it > as a parameter to the grep_* functions. Yes. At the beginning, I placed 'int recurse' in that struct. However, I thought that this struct does not say anything about selecting files, but it says how to grep files (invert, count, fixed [string], binary etc.). Most of opts (if not all) are used in grep.c, not builtin-grep.c. > > > diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh > > index 7868af8..6d1faf4 100755 > > --- a/t/t7002-grep.sh > > +++ b/t/t7002-grep.sh > > @@ -22,7 +22,9 @@ test_expect_success setup ' > > echo zzz > z && > > mkdir t && > > echo test >t/t && > > - git add file w x y z t/t && > > + mkdir t/a && > > + echo aa aa aa aa >t/a/a && > > + git add file w x y z t/t t/a/a && > > This conflicts with a recent change. Yeah, I found out that... > > It seems your patch still allows recursion, one level deep. In git's > repo: > > $ grep -l --directories=skip GNU compat > > $ grep -l --directories=skip GNU compat/* > compat/qsort.c > compat/snprintf.c > > $ git grep -l --directories=skip GNU compat > compat/qsort.c > compat/snprintf.c > > $ git grep -l --directories=skip GNU compat/* > compat/fnmatch/fnmatch.c > compat/fnmatch/fnmatch.h > compat/nedmalloc/malloc.c.h > compat/nedmalloc/nedmalloc.c > compat/nedmalloc/nedmalloc.h > compat/qsort.c > compat/regex/regex.c > compat/regex/regex.h > compat/snprintf.c > > René Actually, this is what I wanted: Do not descend to subdirectories of selected directories. After a while, I think this action should be called "read [files in that directory]", not "skip".