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

Weird behavior with git grep --recurse-submodules

From
DZDaniel Zaoui <jackdanielz@eyomi.org>
Date
Jul 8, 2019, 08:14 UTC
Message-ID
<20190708111459.135abe50@zen>
Hi guys,
I work with submodules and use git grep a lot.
I noted that when it is invoked used with --recurse-submodules, the result is not as expected for the submodules. I get submodules results as if no files were modified (like --cached option) although I would expect results taking into account the modifications.
Expected behavior:
git grep --recurse-submodules string:
- git grep string // search into main repo
- for each submodule, git grep string // search into submodule
Actual behavior:
git grep --recurse-submodules string:
- git grep string // search into main repo
- for each submodule, git grep --cached string // search into submodule
Do you get the same behavior? Am I doing something wrong? Was I understandable :-)? Is it a bug?

git --version: git version 2.22.0 uname -a: Linux daniel 5.1.15-arch1-1-ARCH #1 SMP PREEMPT Tue Jun 25 04:49:39 UTC 2019 x86_64 GNU/Linux

Thanks Daniel

Next: Matheus Tavares Bernardino
Message 1 of 14 in “Weird behavior with git grep --recurse-submodules”
  1. Daniel ZaouiJul 8, 2019
  2. Matheus Tavares BernardinoJul 10, 2019
  3. Johannes SchindelinJul 10, 2019
  4. Daniel ZaouiJul 16, 2019
  5. Matheus Tavares BernardinoJul 29, 2019
  6. [GSoC][PATCH] grep: fix worktree case in submodulesMatheus Tavares, Jul 30, 2019
  7. Junio C HamanoJul 30, 2019
  8. Christian CouderJul 30, 2019
  9. Junio C HamanoJul 31, 2019
  10. Matheus Tavares BernardinoAug 1, 2019
  11. Matheus Tavares BernardinoJul 30, 2019
  12. [GSoC][PATCH v2] grep: fix worktree case in submodulesMatheus Tavares, Jul 31, 2019
  13. [GSoC][PATCH v3] grep: fix worktree case in submodulesMatheus Tavares, Aug 1, 2019
  14. Brandon WilliamsAug 3, 2019

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.