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

[PATCH 00/13] Centralize management of object database sources

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 19, 2025, 07:50 UTC
Message-ID
<20251119-b4-pks-odb-creation-v1-0-2b2ed2612cb6@pks.im>
Hi,

currently, the creation of the object databases is handled both by "setup.c" and by "odb.c". While it's expected that "setup.c" is the one setting up the object database itself, what's less so is that there is a shared responsibility for managing its sources:

  - The primary object database source gets created in "setup.c".
  - The temporary source used during ODB transactions is handled by
    "setup.c" when changing the current working directory.
  - Relative paths stored in object database sources get updated by
    "setup.c" when changing the current working directory.

This means that the management of ODB sources is somewhat cluttered and thus hard to understand. Furthermore, it has the consequence that "setup.c" reaches into internals of the ODB that really shouldn't be any of its concern.

This patch series cleans that up and moves all handling of ODB sources into "odb.c". This hopefully makes the logic easier to understand and it will allow us to eventually handle the logic for different backends in a single central location.

The series is structured as follows:
  - Patches 1 to 5 clean up some smaller nuisances in the vicinity.
  - Patches 6 to 9 refactor a couple of callsites that play weird games
    with the object database. These cause us to re-initialize the ODB
    multiple times, which will not be allowed anymore at the end of this
    series.
  - Patches 10 to 13 move the logic that manages object sources from
    "setup.c" into "odb.c".

This series is built on top of v2.52.0 with ps/object-source-loose at 3e5e360888 (object-file: refactor writing objects via a stream, 2025-11-03) merged into it.

Thanks!
Patrick
---
Patrick Steinhardt (13):
      path: move `enter_repo()` into "setup.c"
      setup: convert `set_git_dir()` to have file scope
      odb: adopt logic to close object databases
      odb: refactor `odb_clear()` to `odb_free()`
      odb: move logic to disable ref updates into repo
      oidset: introduce `oidset_equal()`
      builtin/index-pack: fix deferred fsck outside repos
      t/helper: stop setting up `the_repository` repeatedly
      http-push: stop setting up `the_repository` for each reference
      odb: handle initialization of sources in `odb_new()`
      chdir-notify: add function to unregister listeners
      odb: handle changing a repository's commondir
      odb: handle recreation of quarantine directories
 builtin/clone.c            |   2 +-
 builtin/gc.c               |   2 +-
 builtin/index-pack.c       |  21 ++++-
 builtin/receive-pack.c     |   2 +-
 builtin/repack.c           |   2 +-
 builtin/upload-archive.c   |   2 +-
 builtin/upload-pack.c      |   2 +-
 chdir-notify.c             |  18 ++++
 chdir-notify.h             |   2 +
 fsck.c                     |   6 ++
 fsck.h                     |   7 ++
 http-backend.c             |   1 +
 http-push.c                |   5 +-
 midx-write.c               |   2 +-
 odb.c                      |  98 +++++++++++++++++----
 odb.h                      |  37 +++++---
 oidset.c                   |  16 ++++
 oidset.h                   |   9 +-
 packfile.c                 |  15 ----
 packfile.h                 |   1 -
 path.c                     | 100 ---------------------
 path.h                     |  15 ----
 refs.c                     |   2 +-
 repository.c               |  27 ++----
 repository.h               |  10 ++-
 run-command.c              |   2 +-
 scalar.c                   |   2 +-
 setup.c                    | 214 +++++++++++++++++++++++++++++++--------------
 setup.h                    |  39 ++++++++-
 t/helper/test-repository.c |  16 +---
 t/t5302-pack-index.sh      |  16 ++++
 31 files changed, 414 insertions(+), 279 deletions(-)

--- base-commit: 0ce8ad0c2b447fea8e7abd0236367a9f38ce92fe change-id: 20251107-b4-pks-odb-creation-96c18fdab1d2

Next: Patrick Steinhardt
Message 1 of 21 in “Centralize management of object database sources”
  1. 00/13 Centralize management of object database sourcesPatrick Steinhardt, Nov 19, 2025
  2. 01/13 path: move `enter_repo()` into "setup.c"Patrick Steinhardt, Nov 19, 2025
  3. 02/13 setup: convert `set_git_dir()` to have file scopePatrick Steinhardt, Nov 19, 2025
  4. 03/13 odb: adopt logic to close object databasesPatrick Steinhardt, Nov 19, 2025
  5. 04/13 odb: refactor `odb_clear()` to `odb_free()`Patrick Steinhardt, Nov 19, 2025
  6. 05/13 odb: move logic to disable ref updates into repoPatrick Steinhardt, Nov 19, 2025
  7. Junio C HamanoNov 19, 2025
  8. Patrick SteinhardtNov 21, 2025
  9. 06/13 oidset: introduce `oidset_equal()`Patrick Steinhardt, Nov 19, 2025
  10. Junio C HamanoNov 19, 2025
  11. 07/13 builtin/index-pack: fix deferred fsck outside reposPatrick Steinhardt, Nov 19, 2025
  12. Junio C HamanoNov 19, 2025
  13. Patrick SteinhardtNov 21, 2025
  14. 08/13 t/helper: stop setting up `the_repository` repeatedlyPatrick Steinhardt, Nov 19, 2025
  15. 09/13 http-push: stop setting up `the_repository` for each referencePatrick Steinhardt, Nov 19, 2025
  16. 10/13 odb: handle initialization of sources in `odb_new()`Patrick Steinhardt, Nov 19, 2025
  17. 11/13 chdir-notify: add function to unregister listenersPatrick Steinhardt, Nov 19, 2025
  18. 12/13 odb: handle changing a repository's commondirPatrick Steinhardt, Nov 19, 2025
  19. Junio C HamanoNov 20, 2025
  20. Patrick SteinhardtNov 21, 2025
  21. 13/13 odb: handle recreation of quarantine directoriesPatrick Steinhardt, Nov 19, 2025

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.