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

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

From
Stefan Beller <sbeller@google.com>
Date
Oct 5, 2018, 19:17 UTC
Message-ID
<CAGZ79kbQMg0sQbwhnjV1eO-LmRifJs1jzAkZmHT0+OS4RxRJwA@mail.gmail.com>
In-Reply-To
<20181005130516.3qnhtjg7js53iomf@shiar.net>
On Fri, Oct 5, 2018 at 6:05 AM Mischa POSLAWSKY <git@shiar.nl> wrote:
Show 19 quoted lines
>
> Junio C Hamano wrote 2018-10-05 1:19 (-0700):
> > Stefan Beller <sbeller@google.com> writes:
> >
> > > git-grep is always file/tree recursive, but there is --recurse-submodules
> > > which is off by default. Instead of providing a short alias to a noop,
> > > we could use -r for submodules. (And if you happen to have no
> > > submodules, this is a noop for you)
> >
> > I am not sure if it is an overall win for those who do have and use
> > submodules to easily be able to go recursive with a short-and-sweet
> > 'r', or even they want to work inside one project at a time most of
> > the time.  If the latter, then using 'r' for recurse-submodules is
> > going to be a mistake (besides, other commands that have 'recursive'
> > typically use 'r' for its shorthand,and 'r' does not stand for
> > 'recurse-submodules' for them).
>
> Personally I would welcome a shorthand for --recurse-submodules,
> especially if --r^I no longer completes to this.

The new switch differs by one dash, so I'd think the double dashed version would still autocomplete.

Unrelated to this, but more to submodules: There is submodule.recurse which you may want to set. Would you be interested in a more specific config option there? (i.e. grep.recurseSubmodules to only apply to grep recursing into submodules, just like fetch.recurseSubmodules only applies to fetch)

> It is also closer to the behaviour provided by grep -r as that recurses
> into submodules as well.

That sort of makes for the grep case, but not for other commands. See the related discussion at https://public-inbox.org/git/20180907064026.GB172953@aiede.svl.corp.google.com/

Previous: Mischa POSLAWSKY
Message 15 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.