Subject: Re: feature request: excluding files/paths from "git grep"

From: Michael J Gruber <[email-masked]>
Date: Thu, 26 Feb 2015 12:16:25 +0100

Jeff King venit, vidit, dixit 25.02.2015 20:11:
> On Wed, Feb 25, 2015 at 11:01:22AM -0800, Junio C Hamano wrote:
> 
>> Jeff King <[email-masked]> writes:
>>
>>> So I think _if_ using "diff" attributes is enough for this purpose, then
>>> there is no code to be written.  But if somebody wants to draw a
>>> distinction between the uses (I want to diff "foo" files, but never see
>>> them in grep) then we could introduce a "grep" attribute (with the
>>> fallback being the value of the "diff" attribute for that path).
>>
>> That is all true.
>>
>> If we were to have a new 'grep' attribute that can be used to
>> express 'It is OK to diff two versions of this path, but hits by
>> grep in this path is useless' (and verse versa), the built-in macro
>> attribute 'binary' should also be updated with it.  A path being
>> 'binary' currently means '-diff -merge -text' but it should also
>> mean '-grep' in the new world, if we were to go in that direction.
> 
> I think it would do so automatically. There is no "grep" attribute
> given, so we fall back to the "-diff" attribute. But I do not mind
> modifying the macro to be more explicit.
> 
> Note also that I am not volunteering to work on this, nor am I convinced
> it's actually worth pursuing. I've yet to see a useful case where you
> would want text diffs but not greps (or vice versa), and if we can avoid
> cluttering the attribute space, we should. I was mostly pointing it out
> that it is not logically inconsistent to want such a thing. :)
> 
> If somebody does look into it, I suspect the place to start is modifying
> userdiff_find_by_path to optionally prefer "grep" to "diff".
> 
> -Peff
> 

So, as a summary of the discussion, it seems it's time to switch the
default to --textconv for git grep?

Michael