Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Root <rootminus0x1@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] grep --recurse-submodules <tree> dies on a directory inside a submodule
Date: Fri, 30 Oct 2026 11:26:35 +0100	[thread overview]
Message-ID: <auRw2yZv6p4MKwNJ@pks.im> (raw)
In-Reply-To: <CAMtVYEjWd2XwJpXdk3PV2jbNdoOaqS3x+08EMu5byy55RxfRmA@mail.gmail.com>

Hi,

On Thu, Oct 29, 2026 at 07:52:07PM +0000, Root wrote:
> 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>

      reply	other threads:[~2026-10-30 10:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 19:52 [BUG] grep --recurse-submodules <tree> dies on a directory inside a submodule Root
2026-10-30 10:26 ` Patrick Steinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auRw2yZv6p4MKwNJ@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=rootminus0x1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox