git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
TSTrevor Saunders <tbsaunde@tbsaunde.org>
Date
Feb 27, 2015, 10:04 UTC
Message-ID
<20150227100441.GA11861@tsaunders-iceball.corp.tor1.mozilla.com>
In-Reply-To
<20150225191108.GA17467@peff.net>
On Wed, Feb 25, 2015 at 02:11:08PM -0500, Jeff King wrote:
Show 28 quoted lines
> On Wed, Feb 25, 2015 at 11:01:22AM -0800, Junio C Hamano wrote:
> 
> > Jeff King <peff@peff.net> 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. :)
 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.
 Trev
Show 9 quoted lines
> 
> 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
> --
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 21 in “feature request: excluding files/paths from "git grep"”
  1. Noel GrandinFeb 25, 2015
  2. Duy NguyenFeb 25, 2015
  3. Jeff KingFeb 25, 2015
  4. Junio C HamanoFeb 25, 2015
  5. Jeff KingFeb 25, 2015
  6. Junio C HamanoFeb 25, 2015
  7. Jeff KingFeb 25, 2015
  8. Michael J GruberFeb 26, 2015
  9. Duy NguyenFeb 26, 2015
  10. Junio C HamanoFeb 26, 2015
  11. Michael J GruberFeb 27, 2015
  12. Junio C HamanoFeb 27, 2015
  13. Trevor SaundersFeb 27, 2015
  14. Junio C HamanoMar 1, 2015
  15. Trevor SaundersMar 1, 2015
  16. Junio C HamanoMar 1, 2015
  17. Trevor SaundersMar 2, 2015
  18. Noel GrandinMar 4, 2015
  19. Junio C HamanoMar 4, 2015
  20. Jeff KingMar 5, 2015
  21. Junio C HamanoMar 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.