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

[PATCH 00/18] odb: make loose object source a proper `struct odb_source`

From
Patrick Steinhardt <ps@pks.im>
Date
May 21, 2026, 08:22 UTC
Message-ID
<20260521-b4-pks-odb-source-loose-v1-0-6553b399be2d@pks.im>
Hi,

this patch series converts the loose object source into a proper `struct odb_source` so that it can be used via our generic interfaces.

The patch series is relatively straight-forward, as the source basically already exists as such and the interfaces already match. So for most of the part we are just moving around some code and converting functions that were previously called directly into callbacks.

I guess the only part that needs some attention is that there is some confusion at first with the `struct odb_source_loose::source` parent pointer that initially points at the owning `struct odb_source_files`. This relationship doesn't make much sense, as a loose source can totally exist standalone without the files source.

We're thus getting rid of this relationship in this series, too. I found it quite hard to reason about which pointer one is holding at any point in time though, doubly so because the parent pointer was named "source", which is rather generic. The second commit thus renames the pointer to `files` and converts it into `struct odb_source_files` to make the transition cleaner, but the whole pointer will be dropped at the end of this series.

The series is built on top of aec3f58750 (Sync with 'maint', 2026-05-21) with ps/odb-in-memory at d2902a4549 (t/unit-tests: add tests for the in-memory object source, 2026-04-10) merged into it.

Thanks!
Patrick
---
Patrick Steinhardt (18):
      odb/source-loose: move loose source into "odb/" subsystem
      odb/source-loose: store pointer to "files" instead of generic source
      odb/source-loose: start converting to a proper `struct odb_source`
      odb/source-loose: wire up `reprepare()` callback
      odb/source-loose: wire up `close()` callback
      odb/source-loose: wire up `read_object_info()` callback
      odb/source-loose: wire up `read_object_stream()` callback
      odb/source-loose: wire up `for_each_object()` callback
      odb/source-loose: wire up `find_abbrev_len()` callback
      odb/source-loose: wire up `count_objects()` callback
      odb/source-loose: drop `odb_source_loose_has_object()`
      odb/source-loose: wire up `freshen_object()` callback
      loose: refactor object map to operate on `struct odb_source_loose`
      odb/source-loose: wire up `write_object()` callback
      object-file: refactor writing objects to use loose source
      odb/source-loose: wire up `write_object_stream()` callback
      odb/source-loose: stub out remaining callbacks
      odb/source-loose: drop pointer to the "files" source
 Makefile               |   1 +
 builtin/cat-file.c     |   5 +-
 builtin/gc.c           |   6 +-
 builtin/pack-objects.c |  12 +-
 http-walker.c          |   3 +-
 http.c                 |   6 +-
 loose.c                |  45 ++-
 loose.h                |   4 +-
 meson.build            |   1 +
 object-file.c          | 796 ++++---------------------------------------------
 object-file.h          | 149 ++++-----
 odb/source-files.c     |  28 +-
 odb/source-loose.c     | 736 +++++++++++++++++++++++++++++++++++++++++++++
 odb/source-loose.h     |  48 +++
 odb/source.h           |   3 +
 15 files changed, 973 insertions(+), 870 deletions(-)

--- base-commit: 072edab49f312c80561b2899f03f361f74fc38e4 change-id: 20260413-b4-pks-odb-source-loose-4900c8ca91db

Next: Patrick Steinhardt
Message 1 of 46 in “odb: make loose object source a proper `struct odb_source`”
  1. 00/18 odb: make loose object source a proper `struct odb_source`Patrick Steinhardt, May 21, 2026
  2. 01/18 odb/source-loose: move loose source into "odb/" subsystemPatrick Steinhardt, May 21, 2026
  3. 02/18 odb/source-loose: store pointer to "files" instead of generic sourcePatrick Steinhardt, May 21, 2026
  4. 03/18 odb/source-loose: start converting to a proper `struct odb_source`Patrick Steinhardt, May 21, 2026
  5. Junio C HamanoMay 21, 2026
  6. 04/18 odb/source-loose: wire up `reprepare()` callbackPatrick Steinhardt, May 21, 2026
  7. 05/18 odb/source-loose: wire up `close()` callbackPatrick Steinhardt, May 21, 2026
  8. 06/18 odb/source-loose: wire up `read_object_info()` callbackPatrick Steinhardt, May 21, 2026
  9. 07/18 odb/source-loose: wire up `read_object_stream()` callbackPatrick Steinhardt, May 21, 2026
  10. 08/18 odb/source-loose: wire up `for_each_object()` callbackPatrick Steinhardt, May 21, 2026
  11. 09/18 odb/source-loose: wire up `find_abbrev_len()` callbackPatrick Steinhardt, May 21, 2026
  12. 10/18 odb/source-loose: wire up `count_objects()` callbackPatrick Steinhardt, May 21, 2026
  13. 11/18 odb/source-loose: drop `odb_source_loose_has_object()`Patrick Steinhardt, May 21, 2026
  14. 12/18 odb/source-loose: wire up `freshen_object()` callbackPatrick Steinhardt, May 21, 2026
  15. 13/18 loose: refactor object map to operate on `struct odb_source_loose`Patrick Steinhardt, May 21, 2026
  16. 14/18 odb/source-loose: wire up `write_object()` callbackPatrick Steinhardt, May 21, 2026
  17. 15/18 object-file: refactor writing objects to use loose sourcePatrick Steinhardt, May 21, 2026
  18. 16/18 odb/source-loose: wire up `write_object_stream()` callbackPatrick Steinhardt, May 21, 2026
  19. Junio C HamanoMay 21, 2026
  20. Patrick SteinhardtMay 22, 2026
  21. 17/18 odb/source-loose: stub out remaining callbacksPatrick Steinhardt, May 21, 2026
  22. 18/18 odb/source-loose: drop pointer to the "files" sourcePatrick Steinhardt, May 21, 2026
  23. 00/18 odb: make loose object source a proper `struct odb_source`Patrick Steinhardt, Jun 1, 2026
  24. 01/18 odb/source-loose: move loose source into "odb/" subsystemPatrick Steinhardt, Jun 1, 2026
  25. Karthik NayakJun 3, 2026
  26. Patrick SteinhardtJun 3, 2026
  27. Karthik NayakJun 3, 2026
  28. 02/18 odb/source-loose: store pointer to "files" instead of generic sourcePatrick Steinhardt, Jun 1, 2026
  29. 03/18 odb/source-loose: start converting to a proper `struct odb_source`Patrick Steinhardt, Jun 1, 2026
  30. 04/18 odb/source-loose: wire up `reprepare()` callbackPatrick Steinhardt, Jun 1, 2026
  31. 05/18 odb/source-loose: wire up `close()` callbackPatrick Steinhardt, Jun 1, 2026
  32. 06/18 odb/source-loose: wire up `read_object_info()` callbackPatrick Steinhardt, Jun 1, 2026
  33. 07/18 odb/source-loose: wire up `read_object_stream()` callbackPatrick Steinhardt, Jun 1, 2026
  34. 08/18 odb/source-loose: wire up `for_each_object()` callbackPatrick Steinhardt, Jun 1, 2026
  35. 09/18 odb/source-loose: wire up `find_abbrev_len()` callbackPatrick Steinhardt, Jun 1, 2026
  36. 10/18 odb/source-loose: wire up `count_objects()` callbackPatrick Steinhardt, Jun 1, 2026
  37. 11/18 odb/source-loose: drop `odb_source_loose_has_object()`Patrick Steinhardt, Jun 1, 2026
  38. 12/18 odb/source-loose: wire up `freshen_object()` callbackPatrick Steinhardt, Jun 1, 2026
  39. 13/18 loose: refactor object map to operate on `struct odb_source_loose`Patrick Steinhardt, Jun 1, 2026
  40. 14/18 odb/source-loose: wire up `write_object()` callbackPatrick Steinhardt, Jun 1, 2026
  41. 15/18 object-file: refactor writing objects to use loose sourcePatrick Steinhardt, Jun 1, 2026
  42. 16/18 odb/source-loose: wire up `write_object_stream()` callbackPatrick Steinhardt, Jun 1, 2026
  43. 17/18 odb/source-loose: stub out remaining callbacksPatrick Steinhardt, Jun 1, 2026
  44. 18/18 odb/source-loose: drop pointer to the "files" sourcePatrick Steinhardt, Jun 1, 2026
  45. Junio C HamanoJun 1, 2026
  46. Junio C HamanoJun 1, 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.