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

From: Junio C Hamano <[email-masked]>
Date: Sat, 28 Feb 2015 19:06:16 -0800

Trevor Saunders <[email-masked]> writes:

>  There have been cases where I wanted grep to always ignore certain
>  files, but to still get text diffs for those files.  One case is people
>  insist on using ChangeLog files, and another is people who commit
>  generated files of one sort or another.

The attributes are to say "the contents to be stored in this file is
of this nature".  Something inherent to the type of the contents,
and that is why there is no way to countermand them from the command
line.

The "nature of the content" may be "result of comparing two versions
of them textually will never make sense to humans", or "result of
finding substrings in them will never make sense to humans", which
are what "-diff" and hypothetical "-grep" mean, respectively.

"It is inconvenient that I see hits in ChangeLog files when I look
for string BUG" does not make ChangeLog inherently "result of
finding substrings in it never makes sense to humans"-kind of file
type.  Maybe somebody who is playing a role of a coder right now may
not look at existing ChangeLog entries, but when that same person
plays the role of a release manager next day, running grep on older
ChangeLog files may become necessary to find changes related to
recent changes.  For these "per-invocation" differences, attributes
to declare permenent/inherent nature of the contents is much less
suited than per-invocation inclusion/exclusion mechanism based on
pathspecs, I would think.