Re: [PATCH] git-grep: --and to combine patterns with and instead of or

From: Andreas Ericsson <ae@op5.se>
Date: 2006-07-03 17:54:22
Junio C Hamano wrote:
> Matthias Lederhofer <matled@gmx.net> writes:
> 
> 
>>Junio C Hamano wrote:
>>
>>>I see you are trying hard to think of a way to justify your
>>>original prefix "--and" (or --FOO) implementation, but I simply
>>>do not see much point in that.  I doubt changing the default
>>>operator from --or to --and is less confusing than changing the
>>>precedence for the users, so you would hear the same "I
>>>personally feel FOO should not even exist" objection from me.
>>
>>It just happens to make more sense to me and I don't see a reason not to
>>add this. If no one else is interested in this I'll just stop arguing :)
>>Here again an overview of the arguments if anyone is interested:
>>- Less to type for common searches using only AND (or more ANDs than
>>  ORs).
>>- Easy to implement (both with and without extended expressions).
>>- AND/* is the normal implicit operator in other contexts than grep
>>  (math).
>>- The high precedence operator (AND) should be implicit rather than
>>  the low precedence one (OR) (so this is only fulfilled when the
>>  option is used).
> 
> 
> Side note.  It would be interesting to have a slightly different
> form of --and called --near.  You would use it like this:
> 
> 	git grep -C -e AND --near -e OR
> 
> to find lines that has AND on it, and within the context
> distance there is a line that has OR on it.  The lines that are
> hit with such a query are still the ones that have AND on them
> (in other words, a line that has OR is used to further filter
> out the results so it will be prefixed with '-', not ':', unless
> that line happens to also have AND on it).
> 

It would also be neat to have --inside main or some such, to make it 
only check for things inside whatever's printed on the diff --git line.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Jul 03 17:54:58 2006

This archive was generated by hypermail 2.1.8 : 2006-07-03 17:55:29 EST