# Patrick Steinhardt moves loose-object logic into its own backend file

_The refactoring is meant to show which parts of Git still depend on loose-backend internals, ahead of similar series for the packed and files backends._

Section: Patches. Edition of 2026-11-03. Written by an AI editor from the thread "[PATCH 0/6] object-file: move logic related to the loose backend" (7 messages): https://gitlist.dev/t/66744

Patrick Steinhardt's series moves logic related to the loose object backend out of object-file.c and into odb/source-loose.c. He says this makes the backend more self-contained. It also lets contributors find, by grepping for files that include odb/source-loose.h, exactly which code still touches the backend's internals.

That second reason is the main driver. Steinhardt has two more series pending that do the same for the packed and files backends. Once they are in, it would be easy to check which subsystems are fully backend-agnostic and which need more work.

The patches in the excerpts include one that removes the git_zstream header from object-file.h and adds it to the files that depended on it. Another moves the code for iterating loose objects and for deriving a loose object's path. Others deduplicate the object-mmap logic and move the loose-object read code, about 300 lines, and the series ends by dropping the include of odb/source-loose.h from object-file.h so users include it explicitly.

Steinhardt notes that the path-derivation helper stays externally visible because the dumb transport still needs it to place downloaded objects, and that this will eventually need to be abstracted. He also notes that the iteration function takes a generic struct odb_source and should eventually take struct odb_source_loose. No reviews had arrived in the excerpts.
