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 24, 2013, 19:40 UTC
Message-ID
<xmqqd2muo3sz.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20131024022736.GA24992@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> That would also provide people who do not like the change of default an
> escape hatch to keep the current behavior. And I do not think scripted
> use will be inconvenienced; they will already have to use "." or ":/" to
> be explicit (if they care) since the behavior is changing.

There is a big difference between "scripted use will have an escape hatch" and "scripted use will not be inconvenienced". We *know* scripts will be inconvenienced with or without such a configuration variable, as they *have* to be updated if they rely on the current behaviour of "git grep" that limits its search to the current directory when fed no pathspec (and if their users want to keep the current behaviour of such scripts). Anything short of a warning (or even erroring out) that is designed to annoy the users during the transition period will help ease the pain of transition of scripts.

An annoying warning still can only *ease*, but cannot eliminate, the pain of transition. The scripts need to be updated to adjust to the new behaviour; there is no getting around to it.

Even if we ignore the "helping your colleague at her terminal", cf.
    http://thread.gmane.org/gmane.comp.version-control.git/133570/focus=133683

issue for now, adding a new configuration variable from day one makes the transition of scripts somewhat worse, I am afraid. Doing so robs us a way to add such an annoying warning to help people foresee problems in their existing scripts before the default changes (the configuration presumably will disable the "this command line will behave differently after the default changes" warning).

As I said, I think we can train people without an annoying warning, as hits outside their current directory will serve as an annoyance already, and people who set such a configuration in their repository (or $HOME/.gitconfig), get used to the chosen behaviour too much, and get surprised when they get to use a vanilla intallation of Git (either helping colleague or setting up a new work environment) have only themselves to blame, so it may not be too big a deal.

But I do not think the same reasoning extends to scripted uses X-<.
Previous: Jeff KingNext: David Aguilar
Message 11 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.