From: Patrick Steinhardt Date: Mon, 02 Nov 2026 11:20:16 GMT Subject: [PATCH 0/6] object-file: move logic related to the loose backend Message-ID: <20261102-pks-odb-loose-cleanups-v1-0-fbbc86c29693@pks.im> Hi, this small patch series moves logic that relates to the loose backend from "object-file.c" into "odb/source-loose.c". On the one hand this makes the backend more self-contained. On the other hand, this also lets us quickly identify exactly those code units that still access internal implementation details of the "loose" backend by grepping for those files that include "odb/source-loose.h". The second reason is in fact the main driver. I've got two more patch series pending that do the same for the "packed" and "files" backends. With those changes in it becomes trivial to do a quick "reality" check of which subsystems are fully backend agnostic and which ones still need more work. The series is built on top of ebdc087dc99 (The 13th batch, 2026-11-01), but it conflicts with bc/restrict-hex-to-lowercase. This conflict can be easily resolved by deleting the conflicting section in "object-file.c" and adding this diff in "odb/source-loose.c": diff --git a/odb/source-loose.c b/odb/source-loose.c index 54f680d6d78..e92da0d8b2e 100644 --- a/odb/source-loose.c +++ b/odb/source-loose.c @@ -81,7 +81,7 @@ static int for_each_file_in_obj_subdir(unsigned int subdir_nr, strbuf_add(path, de->d_name, namelen); if (namelen == algop->hexsz - 2 && !hex_to_bytes(oid.hash + 1, de->d_name, - algop->rawsz - 1)) { + algop->rawsz - 1, HEX_KIND_OID)) { oid_set_algo(&oid, algop); memset(oid.hash + algop->rawsz, 0, GIT_MAX_RAWSZ - algop->rawsz); Thanks! Patrick --- Patrick Steinhardt (6): object-file: move logic to read loose objects into backend object-file: move logic to derive loose object paths into backend object-file: move iteration over loose files into backend odb/source-loose: deduplicate logic to mmap objects object-file: stop including "odb/source-loose.h" object-file: stop including "git-zlib.h" apply.c | 1 + builtin/count-objects.c | 1 + builtin/fast-import.c | 1 + builtin/gc.c | 1 + builtin/index-pack.c | 1 + builtin/pack-objects.c | 2 + builtin/prune.c | 1 + diff.c | 1 + http-walker.c | 1 + http.c | 1 + loose.c | 1 + object-file.c | 419 +--------------------------------------------- object-file.h | 100 +---------- odb/source-loose.c | 429 ++++++++++++++++++++++++++++++++++++++++++++++-- odb/source-loose.h | 41 +++++ pack-check.c | 1 + packfile.c | 1 + prune-packed.c | 1 + setup.c | 1 + 19 files changed, 476 insertions(+), 529 deletions(-) --- base-commit: ebdc087dc99d68bb340c282b2ba5f722def28d19 change-id: 20261013-pks-odb-loose-cleanups-fb7e5b890389