Re: [PATCH/RFC] grep: Add --directories option.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> 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".
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]