From: Patrick Steinhardt Date: Fri, 11 Sep 2026 13:27:24 GMT Subject: [PATCH v3 00/10] odb: make consistency checks pluggable Message-ID: <20260911-pks-odb-source-fsck-v3-0-ef2fdc085e38@pks.im> In-Reply-To: <20260825-pks-odb-source-fsck-v1-0-b756de0bf24f@pks.im> Hi, this patch series makes object database consistency checks pluggable. This series is built on top of 2c3adbb2c4 (The 18th batch, 2026-08-24) with the following two dependencsie merged into it: - ps/odb-eagerly-load-alternates at 0076dc9f81 (odb: drop `alternates_db` field, 2026-08-17) - ps/odb-pluggable-pack-generation at 5176dd3d05 (bundle: generate packfiles via the object database, 2026-08-21) Changes in v3: - Move check for `ODB_FSCK_FULL || local` into the "files" backend. - Ensure that repo settings are prepared. - Drop a mostly-useless `ret` variable. - Link to v2: https://patch.msgid.link/20260831-pks-odb-source-fsck-v2-0-f9b16ef4957b@pks.im Changes in v2: - Some commit message improvements. - Link to v1: https://patch.msgid.link/20260825-pks-odb-source-fsck-v1-0-b756de0bf24f@pks.im Thanks! Patrick --- Patrick Steinhardt (10): builtin/fsck: use `fsck_obj_buffer()` when checking loose objects builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()` builtin/fsck: de-globalize option handling builtin/fsck: don't check alternates with "--no-full" odb: provide infrastructure for pluggable fsck checks builtin/fsck: move packfile verification into the packed source builtin/fsck: move reverse index verification into the packed source builtin/fsck: move bitmap verification into the packed source builtin/fsck: move multi-pack index verification into the packed source builtin/fsck: move loose object verification into the loose source builtin/fsck.c | 296 ++++++++---------------------------------- odb.c | 8 ++ odb.h | 33 +++++ odb/source-files.c | 16 +++ odb/source-inmemory.c | 8 ++ odb/source-loose.c | 92 +++++++++++++ odb/source-packed.c | 117 +++++++++++++++++ odb/source.h | 21 +++ pack-bitmap.c | 26 ++-- pack-bitmap.h | 2 +- t/t1450-fsck.sh | 5 + t/t5319-multi-pack-index.sh | 13 ++ t/t5325-reverse-index.sh | 8 ++ t/t5326-multi-pack-bitmaps.sh | 10 +- 14 files changed, 396 insertions(+), 259 deletions(-) Range-diff versus v2: 1: 099ad8ddcd = 1: 575a49f5a1 builtin/fsck: use `fsck_obj_buffer()` when checking loose objects 2: 4e223cfab6 = 2: 71040c9b34 builtin/fsck: merge `fsck_obj_buffer()` and `fsck_obj()` 3: 108b522c55 = 3: adb2e035ee builtin/fsck: de-globalize option handling 4: c686809406 = 4: 68d143fc9f builtin/fsck: don't check alternates with "--no-full" 5: a82a1a8ed2 ! 5: bb785f4f00 odb: provide infrastructure for pluggable fsck checks @@ odb.c: void odb_reprepare(struct object_database *o) +{ + int ret = 0; + for (struct odb_source *source = odb->sources; source; source = source->next) -+ if ((options->flags & ODB_FSCK_FULL) || source->local) -+ ret |= odb_source_fsck(source, options); ++ ret |= odb_source_fsck(source, options); + return ret; +} @@ odb/source-files.c: static int odb_source_files_generate_pack(struct odb_source + struct odb_source_files *files = odb_source_files_downcast(source); + int ret = 0; + ++ if (!(opts->flags & ODB_FSCK_FULL) && !source->local) ++ return 0; ++ + ret |= odb_source_fsck(&files->loose->base, opts); + ret |= odb_source_fsck(&files->packed->base, opts); + 6: 166d9ad073 = 6: 9df4ebd53e builtin/fsck: move packfile verification into the packed source 7: 83f1b18308 = 7: b7b28d2ab4 builtin/fsck: move reverse index verification into the packed source 8: a760738e7a = 8: e0efbab606 builtin/fsck: move bitmap verification into the packed source 9: f0acd3bdff ! 9: 5bebd3fded builtin/fsck: move multi-pack index verification into the packed source @@ odb/source-packed.c: static int verify_reverse_indices(struct odb_source_packed + struct odb_fsck_options *opts) +{ + struct child_process midx_verify = CHILD_PROCESS_INIT; -+ int ret = 0; + ++ prepare_repo_settings(source->base.odb->repo); + if (!source->base.odb->repo->settings.core_multi_pack_index) + return 0; + @@ odb/source-packed.c: static int verify_reverse_indices(struct odb_source_packed + else + strvec_push(&midx_verify.args, "--no-progress"); + if (run_command(&midx_verify)) -+ ret = -1; ++ return -1; + -+ return ret; ++ return 0; +} + static int odb_source_packed_fsck(struct odb_source *source, 10: d140d15980 = 10: f0f00e573a builtin/fsck: move loose object verification into the loose source --- base-commit: 6b08999fb1b3ad0bad04d492dc206ad42839e274 change-id: 20260810-pks-odb-source-fsck-e64772c7ee5f