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

Re: [PATCH] grep: provide a noop --recursive option

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 29, 2018, 17:11 UTC
Message-ID
<xmqq8t3k9qjs.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180929145527.23444-1-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 6 quoted lines
> This --recursive (-r) option does nothing, and is purely here to
> appease people who have "grep -r ..." burned into their muscle memory.
>
> Requested-by: Christoph Berg <myon@debian.org>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---

I personally am not all that sympathetic to the "'git grep' and 'grep' sound similar, so even though it won't do anything useful just add a synonym to noop" line of reasoning. That will lead to sloppy noop, and will invite unbound amount of busywork to deal with future complaints like "oh, but 'grep GNU COPYING' does not give useless filename in front like the same command line with 'git' prefixed; please fix 'git grep'" (which we'd have to say "no", wasting our time).

I however do not mind if we added "--recursive" with matching "--no-recursive", and

 - made "--recursive" the default (obviously)
 - made "--no-recursive" a synonym to setting the recursion limit
   to "never recurse"
 - and made "--recursive" a synonym to setting the recursion limit
   to "infinity".

That would be more work than this patch. But if I see "--recursive" advertised as a feature, and the command by default goes recursive, I do expect to be able to tell it not to recurse.

I also expect folks who are used to "git grep --re<TAB>" to summon the only option of the command that begins with that prefix to start complaining that they now have to type "--recurs<TAB>" instead. I am not solving that with the above suggestion to improve the suggested "noop".

Previous: Duy NguyenNext: Christoph Berg
Message 6 of 15 in “wishlist: git grep -r”
  1. Christoph BergSep 29, 2018
  2. grep: provide a noop --recursive optionÆvar Arnfjörð Bjarmason, Sep 29, 2018
  3. Duy NguyenSep 29, 2018
  4. Ævar Arnfjörð BjarmasonSep 29, 2018
  5. Duy NguyenSep 29, 2018
  6. Junio C HamanoSep 29, 2018
  7. Christoph BergSep 29, 2018
  8. René ScharfeOct 1, 2018
  9. Junio C HamanoOct 5, 2018
  10. Ævar Arnfjörð BjarmasonOct 5, 2018
  11. Stefan BellerOct 1, 2018
  12. Christoph BergOct 5, 2018
  13. Junio C HamanoOct 5, 2018
  14. Mischa POSLAWSKYOct 5, 2018
  15. Stefan BellerOct 5, 2018

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.