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

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

From
Jeff King <peff@peff.net>
Date
Mar 5, 2015, 05:22 UTC
Message-ID
<20150305052206.GC3344@peff.net>
In-Reply-To
<xmqq385k8ot1.fsf@gitster.dls.corp.google.com>
On Wed, Mar 04, 2015 at 12:56:10PM -0800, Junio C Hamano wrote:
Show 6 quoted lines
> > As in, while working on a specific project, I sometimes just want to
> > exclude, for the time being, a bunch of stuff from 'git grep'.
> 
> The key word here is "for the time being", though.  What would you
> do once you are done with the "for the time being" activity?  "git
> config --unset"?

IMHO this is being too paternalistic. You can already shoot yourself in the foot by configuring an alias to grep, running your alias, and wondering why it does not produce the results you wanted.

But I'd also oppose a `grep.pathspecs` config option for a similar reason: you can already accomplish the same thing (and more) with an alias.

-Peff
PS One annoying thing about aliases is that you cannot re-alias an
   existing command, and git has already taken all of the good, easy
   names that we have trained our fingers for. :)
   Of course re-aliasing git-grep is another recipe for head-scratching
   (and broken scripts), but I am not sure there aren't a host of other
   ways to do a similar thing (basically any configuration option has
   the capacity to produce unexpected results if you forget that it is
   set).
   I dunno. Probably I am a bad person for dredging up that ancient
   argument again.
Previous: Junio C HamanoNext: Junio C Hamano
Message 20 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.