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

Re: git grep: search whole tree by default?

From
David Aguilar <davvid@gmail.com>
Date
Oct 25, 2013, 02:23 UTC
Message-ID
<CAJDDKr5G_dpk5s6EMBF=iU+yHkr7TKYRUBJAxBQY9Y9jy6FmCA@mail.gmail.com>
In-Reply-To
<xmqqd2muo3sz.fsf@gitster.dls.corp.google.com>
On Thu, Oct 24, 2013 at 12:40 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 41 quoted lines
> 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-<.

The set of people that script "git grep" may in fact be pretty low / almost non-existent so it may be a non-issue, but here's my one data point:

For git-cola, this change in behavior would not make any difference. It already jumps to the top-level during startup so its grep feature is unaffected.

It'd be good to hear from other script writers but that's my $.02.
-- 
David
Previous: Junio C HamanoNext: Jeff King
Message 12 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.