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

Re: git grep: search whole tree by default?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2013, 17:23 UTC
Message-ID
<xmqqmwlzrjdh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<vpqbo2guff7.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 10 quoted lines
> In summary: changing is painful. The case of "git add" was really bad,
> since the same command had different behavior depending on the options
> given, so it was clearly worth the pain. In the case of "git grep", the
> current behavior is not _that_ bad, so nobody bothered to do the change.
>
> (by "do the change", I mean propose a migration plan, convince people
> that it is good, ...)
>
> I'd personally be slightly in favor of changing to tree-wide, but
> without strong opinion.

After reading that old thread again, I tend to think that the only reason to favor "git grep" to start at the $(cwd) is the backward compatibility. While I do expect that many people will be annoyed when "git grep" (no pathspecs) that is run in a subdirectory starts spitting out a large number of hits from places irrelevant for the current task at hand, hits from outside the $(cwd) is something they can _notice_ easily and their fingers will quickly learn to add "." without even thinking.

I suspect that it would be too late for 2.0 we want to do sometime early next year, though.

Previous: Matthieu MoyNext: Jed Brown
Message 3 of 14 in “git grep: search whole tree by default?”
  1. Piotr KrukowieckiOct 23, 2013
  2. Matthieu MoyOct 23, 2013
  3. Junio C HamanoOct 23, 2013
  4. Jed BrownOct 23, 2013
  5. Junio C HamanoOct 23, 2013
  6. Jed BrownOct 23, 2013
  7. Junio C HamanoOct 23, 2013
  8. David AguilarOct 24, 2013
  9. Matthieu MoyOct 23, 2013
  10. Jeff KingOct 24, 2013
  11. Junio C HamanoOct 24, 2013
  12. David AguilarOct 25, 2013
  13. Jeff KingOct 25, 2013
  14. Duy NguyenOct 25, 2013

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.