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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 1, 2015, 03:06 UTC
Message-ID
<xmqqvbilh0wn.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150227100441.GA11861@tsaunders-iceball.corp.tor1.mozilla.com>
Trevor Saunders <tbsaunde@tbsaunde.org> 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.

Previous: Trevor SaundersNext: Trevor Saunders
Message 14 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.