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

Re: [PATCH] built-in "git grep" (git grip).

From
Junio C Hamano <junkio@cox.net>
Date
May 2, 2006, 21:54 UTC
Message-ID
<7vbqugks8j.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0605021422200.4086@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 13 quoted lines
> On Tue, 2 May 2006, Junio C Hamano wrote:
>> 
>>  - The shell-script one, if you use GNU grep, accepts more
>>    options to grep than what the current built-in one supports.
>>    Notable ones that are missing: fixed strings (-F), patterns
>>    from file (-f), count matches (-c), omit filenames (-h),
>>    skipping binary files (-I, -U), files without match (-L),
>>    pcre (-P), silent (-q), word expression (-w), NUL (-z).  They
>>    should be easy to add if somebody cares enough, and I plan to
>>    do a few myself before pushing it out to "master".
>
> I use "-w" all the time, along with -5 or similar to get context for the 
> grep.

Noted; -w is missing; -A/-B/-C are already there so you could say -C 5 instead, and -<n> should be easy to add.

On a related tangent, ever since I started using the built-in grep with ls-files like wildcard, I find myself typing something like this by mistake (this is from my day-job work project that has src/mx.js and src/mxstyle.css among other things):

	git diff 268a94 -- 'src/mx*'

I am tempted to suggest switching pathspecs used by diff and log family to do the same wildcarding, perhaps after tightening the wildcard vs directory prefix logic used in the builtin-grep of the current "next" tip, which is a bit looser than necessary.

Previous: Linus TorvaldsNext: Linus Torvalds
Message 12 of 21 in “built-in "git grep" (git grip).”
  1. built-in "git grep" (git grip).Junio C Hamano, May 1, 2006
  2. Jakub NarebskiMay 1, 2006
  3. Junio C HamanoMay 1, 2006
  4. Jakub NarebskiMay 1, 2006
  5. Andreas EricssonMay 2, 2006
  6. Jakub NarebskiMay 2, 2006
  7. Junio C HamanoMay 2, 2006
  8. Jakub NarebskiMay 2, 2006
  9. Andreas EricssonMay 2, 2006
  10. Junio C HamanoMay 2, 2006
  11. Linus TorvaldsMay 2, 2006
  12. Junio C HamanoMay 2, 2006
  13. Linus TorvaldsMay 2, 2006
  14. Junio C HamanoMay 3, 2006
  15. built-in "git grep" (git grip) - quickfixJunio C Hamano, May 1, 2006
  16. Sam RavnborgMay 1, 2006
  17. Sam RavnborgMay 1, 2006
  18. Sam RavnborgMay 1, 2006
  19. Linus TorvaldsMay 1, 2006
  20. builtin-grep: wildcard pathspec fixesJunio C Hamano, May 1, 2006
  21. builtin-grep: do not use setup_revisions()Junio C Hamano, May 1, 2006

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.