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

Re: [BUG] grep --recurse-submodules <tree> dies on a directory inside a submodule

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 30, 2026, 10:26 UTC
Message-ID
<auRw2yZv6p4MKwNJ@pks.im>
In-Reply-To
<CAMtVYEjWd2XwJpXdk3PV2jbNdoOaqS3x+08EMu5byy55RxfRmA@mail.gmail.com>
Hi,
On Thu, Oct 29, 2026 at 07:52:07PM +0000, Root wrote:
Show 41 quoted lines
> Hi,
> 
> Since Git 2.56.0, "git grep --recurse-submodules <pattern> <tree>"
> dies when it reaches a directory inside a submodule:
>     fatal: unable to read tree (<id of that directory's tree>)
> 
> The working-tree form ("git grep --recurse-submodules <pattern>") is
> not affected, and neither is a submodule with no directories. Our CI
> passed the same case on 2.55.0.
> 
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
>     #!/bin/sh
>     set -e
>     work=$(mktemp -d)
>     cd "$work"
> 
>     git init -q sub
>     mkdir sub/dir
>     echo hello >sub/top
>     echo hello >sub/dir/nested
>     git -C sub add top dir/nested
>     git -C sub -c user.name=t -c user.email=t@t commit -qm sub
> 
>     git init -q super
>     git -C super -c protocol.file.allow=always \
>         submodule --quiet add "$work/sub" sub
>     git -C super -c user.name=t -c user.email=t@t commit -qm super
> 
>     git -C super grep --recurse-submodules -e hello HEAD
> 
> What did you expect to happen? (Expected behavior)
> 
>     HEAD:sub/dir/nested:hello
>     HEAD:sub/top:hello
> 
> What happened instead? (Actual behavior)
> 
>     fatal: unable to read tree (935cff11a11f8734cf4e0d40955d1e0e5c12038e)
> 
> with exit status 128. The id is that of the tree of sub/dir.
indeed, thanks for the report. I've sent patches to fix this via [1].
Thanks!
Patrick
[1]: <20261030-pks-grep-recurse-submodule-v1-0-d4eb5c87d8fb@pks.im>
Previous: Root
Message 2 of 2 in “[BUG] grep --recurse-submodules <tree> dies on a directory inside a submodule”
  1. RootOct 29, 2026
  2. Patrick SteinhardtOct 30, 2026

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.