git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] Centralize management of object database sources
@ 2025-11-19  7:50 Patrick Steinhardt
  2025-11-19  7:50 ` [PATCH 01/13] path: move `enter_repo()` into "setup.c" Patrick Steinhardt
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Patrick Steinhardt @ 2025-11-19  7:50 UTC (permalink / raw)
  To: git

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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-11-21  8:12 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19  7:50 [PATCH 00/13] Centralize management of object database sources Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 01/13] path: move `enter_repo()` into "setup.c" Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 02/13] setup: convert `set_git_dir()` to have file scope Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 03/13] odb: adopt logic to close object databases Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 04/13] odb: refactor `odb_clear()` to `odb_free()` Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 05/13] odb: move logic to disable ref updates into repo Patrick Steinhardt
2025-11-19 20:51   ` Junio C Hamano
2025-11-21  7:48     ` Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 06/13] oidset: introduce `oidset_equal()` Patrick Steinhardt
2025-11-19 20:59   ` Junio C Hamano
2025-11-19  7:50 ` [PATCH 07/13] builtin/index-pack: fix deferred fsck outside repos Patrick Steinhardt
2025-11-19 21:27   ` Junio C Hamano
2025-11-21  7:48     ` Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 08/13] t/helper: stop setting up `the_repository` repeatedly Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 09/13] http-push: stop setting up `the_repository` for each reference Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 10/13] odb: handle initialization of sources in `odb_new()` Patrick Steinhardt
2025-11-19  7:50 ` [PATCH 11/13] chdir-notify: add function to unregister listeners Patrick Steinhardt
2025-11-19  7:51 ` [PATCH 12/13] odb: handle changing a repository's commondir Patrick Steinhardt
2025-11-20 22:06   ` Junio C Hamano
2025-11-21  8:12     ` Patrick Steinhardt
2025-11-19  7:51 ` [PATCH 13/13] odb: handle recreation of quarantine directories Patrick Steinhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).