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

[PATCH 0/6] object-file: move logic related to the loose backend

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 2, 2026, 11:20 UTC
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
Next: Patrick Steinhardt
Message 1 of 7 in “object-file: move logic related to the loose backend”
  1. 0/6 object-file: move logic related to the loose backendPatrick Steinhardt, Nov 2, 2026
  2. 1/6 object-file: move logic to read loose objects into backendPatrick Steinhardt, Nov 2, 2026
  3. 2/6 object-file: move logic to derive loose object paths into backendPatrick Steinhardt, Nov 2, 2026
  4. 3/6 object-file: move iteration over loose files into backendPatrick Steinhardt, Nov 2, 2026
  5. 4/6 odb/source-loose: deduplicate logic to mmap objectsPatrick Steinhardt, Nov 2, 2026
  6. 5/6 object-file: stop including "odb/source-loose.h"Patrick Steinhardt, Nov 2, 2026
  7. 6/6 object-file: stop including "git-zlib.h"Patrick Steinhardt, Nov 2, 2026

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.