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

Re: Re: [RFC PATCH 3/3] grep: add support for grepping in submodules

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Sep 30, 2010, 18:59 UTC
Message-ID
<20100930185937.GA15457@book.hvoigt.net>
In-Reply-To
<4CA3C569.4020309@gmail.com>
Hi,
On Wed, Sep 29, 2010 at 04:02:01PM -0700, Chris Packham wrote:
Show 17 quoted lines
> On 29/09/10 15:21, Jens Lehmann wrote:
> > Am 29.09.2010 22:28, schrieb Chris Packham:
> >> When the --recurse-submodules option is given git grep will search in
> >> submodules as they are encountered.
> > 
> > As "git clone" already introduced a "--recursive" option for
> > submodule recursion IMO "--recursive" should be used here too for
> > consistency. (Maybe you took the idea to use "--recurse-submodules"
> > from my "git-checkout-recurse-submodules" branch on github? But that
> > is only used there because I didn't get around to change it yet like
> > I did in the "fetch-submodules-too" branch).
> 
> I actually started with --recursive and switched to
> --recurse-submodules. One thing with this is the standard grep
> --recursive option which may cause some confusion if people expect git
> grep to behave like normal grep. I'll switch to using --recursive for
> now until someone objects to the potential confusion.

How about dropping the option all together and making grep search all populated submodules by default and maybe have an option to turn it off. Since git grep is searching recursive by default this would be what I would expect as a user. Are there other reasons to turn off the search in submodules than the potential runtime penalty because of forks?

Show 6 quoted lines
> One more thought on this that has been hanging around in my mind. I
> sometimes want to do something on all but one submodule, in this case
> with grep I'm fairly likely to want to skip a linux repository because I
> already know the thing I'm looking for is in userland. Maybe in the
> future we can make --recursive take an argument that allows us to
> specify/restrict which submodules get included in the command invocation.

Thinking about this how about not providing a disable submodule recursion option at all? Just provide an --exclude option and let it be used transparently for both normal subfolders and submodules?

Cheers Heiko
Previous: Chris PackhamNext: Jens Lehmann
Message 21 of 22 in “grep: submodule support”
  1. 0/3 grep: submodule supportChris Packham, Sep 29, 2010
  2. 1/3 add test for git grep --recursiveChris Packham, Sep 29, 2010
  3. Ævar Arnfjörð BjarmasonSep 29, 2010
  4. Chris PackhamSep 29, 2010
  5. Kevin BallardSep 29, 2010
  6. 2/3 grep: prepare grep for submodulesChris Packham, Sep 29, 2010
  7. Nguyen Thai Ngoc DuySep 30, 2010
  8. Chris PackhamSep 30, 2010
  9. Nguyen Thai Ngoc DuyOct 1, 2010
  10. Chris PackhamOct 1, 2010
  11. 3/3 grep: add support for grepping in submodulesChris Packham, Sep 29, 2010
  12. Jens LehmannSep 29, 2010
  13. Junio C HamanoSep 29, 2010
  14. Chris PackhamSep 29, 2010
  15. Jens LehmannSep 30, 2010
  16. Johannes SixtSep 30, 2010
  17. Jens LehmannSep 30, 2010
  18. Chris PackhamSep 29, 2010
  19. Jens LehmannSep 30, 2010
  20. Chris PackhamSep 30, 2010
  21. Heiko VoigtSep 30, 2010
  22. Jens LehmannSep 30, 2010

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.