Subject: Re: [PATCH 07/13] builtin/index-pack: fix deferred fsck outside repos

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 21 Nov 2025 08:48:35 +0100

On Wed, Nov 19, 2025 at 01:27:51PM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <[email-masked]> writes:
> > +bool fsck_has_queued_checks(struct fsck_options *options)
> > +{
> > +	return !oidset_equal(&options->gitmodules_found, &options->gitmodules_done) ||
> > +	       !oidset_equal(&options->gitattributes_found, &options->gitattributes_done);
> > +}
> 
> So, if we see a tree entry for these special blobs (and remember
> them in the _found oid set) before we see the blobs, fsck_blob()
> would notice that it is looking at the blob that is in these _found
> set, and throw it in _done set while checking the blob in-core.

Yup.

> A packfile we generate has trees before blobs, so a self contained
> pack stream should still be validatable outside a repository with
> this code, but other people's reimplementations of Git may produce
> a packfile that has a blob before a tree that refers to the blob.
> In other words, we can validate a self contained pack stream outside
> repository on a best-effort basis.  And that is perfectly fine.

Yeah, that was my reasoning, as well. Ideally we'd of course do better
here and be able to validate a fully self-contained packfile in all
cases. But that's a bigger change that isn't easy to do now -- it will
become easier though once we have proper pluggable object databases.

Meanwhile, I guess having a proper error message is better than
crashing.

Thanks!

Patrick