From: Rasmus Villemoes <ravi@prevas.dk>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Daniel Mach <daniel.mach@suse.com>
Subject: Re: [PATCH] commit: fall back to full read when maybe_tree is NULL
Date: Tue, 19 May 2026 08:25:21 +0200 [thread overview]
Message-ID: <87o6ibex0u.fsf@prevas.dk> (raw)
In-Reply-To: <20260519050513.GA1635924@coredump.intra.peff.net> (Jeff King's message of "Tue, 19 May 2026 01:05:13 -0400")
On Tue, May 19 2026, Jeff King <peff@peff.net> wrote:
> When we load a commit object from the commit graph (rather than reading
> the object contents), we don't fill in its "maybe_tree" entry, but
> rather wait to lazy-load it. This goes back to 7b8a21dba1 (commit-graph:
> lazy-load trees for commits, 2018-04-06), and saves the work of
> instantiating tree objects that nobody cares about.
>
> But it creates a data dependency: now the commit struct depends on the
> graph file to do that lazy load. This is a problem if we close the graph
> file; now we have a commit struct that claims to be parsed but is
> missing some of its data.
>
> It's rare for this to be a problem in practice, because we don't tend to
> close the graph files at all, and if we do we don't tend to look at
> their commits afterward. But there is one case that is easy to trigger:
> git-clone's --dissociate option will close the object database before
> running the dissociate repack, and then afterwards still try to check
> out the working tree. This will yield an error like:
>
> fatal: unable to parse commit b29edc0babef41810f7b1c9ee1d74058f22e4080
> warning: Clone succeeded, but checkout failed.
>
> What happens is that we expect repo_get_commit_tree() to lazy-load the
> tree, but commit_graph_position() returns COMMIT_NOT_FROM_GRAPH because
> the position slab has gone away (and even if it hadn't, we don't have
> the graph file itself available anymore).
>
> Let's try harder to find the tree in repo_get_commit_tree() by actually
> opening the commit object and parsing the tree line. This is extra work,
> but no more than we'd have to go to if we hadn't done the initial graph
> load in the first place.
I can confirm that this, applied on top of v2.54.0, fixes the problem
for the instance I had.
Tested-by: Rasmus Villemoes <ravi@prevas.dk>
Thanks,
Rasmus
next prev parent reply other threads:[~2026-05-19 6:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 5:05 [PATCH] commit: fall back to full read when maybe_tree is NULL Jeff King
2026-05-19 5:56 ` Junio C Hamano
2026-05-19 6:15 ` Jeff King
2026-05-20 16:22 ` Derrick Stolee
2026-05-19 6:25 ` Rasmus Villemoes [this message]
2026-05-20 16:20 ` Derrick Stolee
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=87o6ibex0u.fsf@prevas.dk \
--to=ravi@prevas.dk \
--cc=daniel.mach@suse.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.