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

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

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 21, 2025, 07:48 UTC
Message-ID
<aSAZU4DlJ7CS7HLj@pks.im>
In-Reply-To
<xmqq1pltbtm0.fsf@gitster.g>
On Wed, Nov 19, 2025 at 01:27:51PM -0800, Junio C Hamano wrote:
Show 11 quoted lines
> Patrick Steinhardt <ps@pks.im> 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.
Show 6 quoted lines
> 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
Previous: Junio C HamanoNext: Patrick Steinhardt
Message 13 of 21 in “Centralize management of object database sources”
  1. 00/13 Centralize management of object database sourcesPatrick Steinhardt, Nov 19, 2025
  2. 01/13 path: move `enter_repo()` into "setup.c"Patrick Steinhardt, Nov 19, 2025
  3. 02/13 setup: convert `set_git_dir()` to have file scopePatrick Steinhardt, Nov 19, 2025
  4. 03/13 odb: adopt logic to close object databasesPatrick Steinhardt, Nov 19, 2025
  5. 04/13 odb: refactor `odb_clear()` to `odb_free()`Patrick Steinhardt, Nov 19, 2025
  6. 05/13 odb: move logic to disable ref updates into repoPatrick Steinhardt, Nov 19, 2025
  7. Junio C HamanoNov 19, 2025
  8. Patrick SteinhardtNov 21, 2025
  9. 06/13 oidset: introduce `oidset_equal()`Patrick Steinhardt, Nov 19, 2025
  10. Junio C HamanoNov 19, 2025
  11. 07/13 builtin/index-pack: fix deferred fsck outside reposPatrick Steinhardt, Nov 19, 2025
  12. Junio C HamanoNov 19, 2025
  13. Patrick SteinhardtNov 21, 2025
  14. 08/13 t/helper: stop setting up `the_repository` repeatedlyPatrick Steinhardt, Nov 19, 2025
  15. 09/13 http-push: stop setting up `the_repository` for each referencePatrick Steinhardt, Nov 19, 2025
  16. 10/13 odb: handle initialization of sources in `odb_new()`Patrick Steinhardt, Nov 19, 2025
  17. 11/13 chdir-notify: add function to unregister listenersPatrick Steinhardt, Nov 19, 2025
  18. 12/13 odb: handle changing a repository's commondirPatrick Steinhardt, Nov 19, 2025
  19. Junio C HamanoNov 20, 2025
  20. Patrick SteinhardtNov 21, 2025
  21. 13/13 odb: handle recreation of quarantine directoriesPatrick Steinhardt, Nov 19, 2025

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.