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

Re: [PATCH v3 0/8] setup: centralize object database creation

From
Karthik Nayak <karthik.188@gmail.com>
Date
Jun 5, 2026, 14:16 UTC
Message-ID
<CAOLa=ZQwVbLsOcajaxQwtkTPm=4St7EiGEEyL6_B0o3Tt1v1pw@mail.gmail.com>
In-Reply-To
<20260604-b4-pks-setup-centralize-odb-creation-v3-0-0691834f318a@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 96 quoted lines
> Hi,
>
> this small patch series refactors the logic for how we discover and
> configure repositories. Most importantly, this involves the following
> two steps:
>
>   1. We unify the logic to apply the repository format, which is
>      currently open-coded across multiple sites. These sites have
>      already diverged, where some repository extensions are not
>      consistently applied.
>
>   2. We then centralize creation of the object database to happen at the
>      same time we apply the repository format.
>
> The end result is that we apply the repository format exactly once, and
> that's also the point in time where we can finalize the setup of the
> repo's data structures as we know about all details of the repo at that
> time. Ultimately, this makes it trivial to introduce the "objectStorage"
> extension, even though that's not part of this patch series.
>
> The series is built on top of aec3f58750 (Sync with 'maint', 2026-05-21)
> with ps/setup-wo-the-repository at df69f40c34 (setup: stop using
> `the_repository` in `init_db()`, 2026-05-19) merged into it.
>
> Changes in v3:
>   - Explain the move of `verify_repository_format()` better.
>   - Document that `apply_repository_format()` also verifies the format.
>   - Link to v2: https://patch.msgid.link/20260526-b4-pks-setup-centralize-odb-creation-v2-0-2fa5b385c13e@pks.im
>
> Changes in v2:
>   - Commit message improvements.
>   - Link to v1: https://patch.msgid.link/20260521-b4-pks-setup-centralize-odb-creation-v1-0-f130d2a7e8ae@pks.im
>
> Thanks!
>
> Patrick
>
> ---
> Patrick Steinhardt (8):
>       t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORY
>       setup: drop `setup_git_env()`
>       setup: deduplicate logic to apply repository format
>       repository: stop initializing the object database in `repo_set_gitdir()`
>       setup: stop creating the object database in `setup_git_env()`
>       setup: stop initializing object database without repository
>       repository: stop reading loose object map twice on repo init
>       setup: construct object database in `apply_repository_format()`
>
>  commit-graph.c  |   4 +-
>  environment.h   |   8 +---
>  refs.c          |   3 +-
>  repository.c    |  40 +++++------------
>  repository.h    |   3 --
>  setup.c         | 130 +++++++++++++++++++++++++++++++-------------------------
>  setup.h         |  20 +++++++++
>  t/t0001-init.sh |  10 +++++
>  8 files changed, 118 insertions(+), 100 deletions(-)
>
> Range-diff versus v2:
>
> 1:  50224c1a12 = 1:  a6f452b947 t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORY
> 2:  6d655e00e3 = 2:  905e618dc6 setup: drop `setup_git_env()`
> 3:  2e7e9bb052 ! 3:  e11f16333d setup: deduplicate logic to apply repository format
>     @@ Commit message
>
>          Introduce a new function `apply_repository_format()` that takes a repo
>          and applies a given format to it and adapt all callsites to use it.
>     -    While at it, rename `check_repository_format()` to clarify that it
>     -    doesn't only _check_ the format, but that it also applies it.
>     +    This function is also the new caller of `verify_repository_format()` so
>     +    that we can ensure that we never apply an invalid repository format.
>     +    The verification we have in `read_and_verify_repository_format()` is
>     +    thus redundant now and dropped.
>     +
>     +    Rename `read_and_verify_repository_format()` accordingly. While at it,
>     +    also rename `check_repository_format()` to clarify that it doesn't only
>     +    _check_ the format, but that it also applies it.
>
>          Signed-off-by: Patrick Steinhardt <ps@pks.im>
>
>     @@ setup.h: void clear_repository_format(struct repository_format *format);
>      +/*
>      + * Apply the given repository format to the repo. This initializes extensions
>      + * and basic data structures required for normal operation. Returns 0 on
>     -+ * success, a negative error code otherwise.
>     ++ * success, a negative error code when the format is not valid as determined by
>     ++ * `verify_repository_format()`.
>      + */
>      +int apply_repository_format(struct repository *repo,
>      +			    const struct repository_format *format,
> 4:  81b92bca7f = 4:  b0d7c11fe6 repository: stop initializing the object database in `repo_set_gitdir()`
> 5:  807fc56353 = 5:  d0af56fdae setup: stop creating the object database in `setup_git_env()`
> 6:  96563ff99f = 6:  3e75c5b0a6 setup: stop initializing object database without repository
> 7:  c14f45169c = 7:  50fa2fdb3c repository: stop reading loose object map twice on repo init
> 8:  e67c6e66d6 = 8:  4dff9d1794 setup: construct object database in `apply_repository_format()`
>
The range-diff looks good and as expected. Thanks!
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 27 of 28 in “setup: centralize object database creation”
  1. 0/8 setup: centralize object database creationPatrick Steinhardt, May 21, 2026
  2. 1/8 t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORYPatrick Steinhardt, May 21, 2026
  3. Junio C HamanoMay 21, 2026
  4. Kristoffer HaugsbakkMay 21, 2026
  5. Patrick SteinhardtMay 22, 2026
  6. Kristoffer HaugsbakkMay 22, 2026
  7. 2/8 setup: drop `setup_git_env()`Patrick Steinhardt, May 21, 2026
  8. 3/8 setup: deduplicate logic to apply repository formatPatrick Steinhardt, May 21, 2026
  9. 4/8 repository: stop initializing the object database in `repo_set_gitdir()`Patrick Steinhardt, May 21, 2026
  10. 5/8 setup: stop creating the object database in `setup_git_env()`Patrick Steinhardt, May 21, 2026
  11. 6/8 setup: stop initializing object database without repositoryPatrick Steinhardt, May 21, 2026
  12. 7/8 repository: stop reading loose object map twice on repo initPatrick Steinhardt, May 21, 2026
  13. 8/8 setup: construct object database in `apply_repository_format()`Patrick Steinhardt, May 21, 2026
  14. Junio C HamanoMay 21, 2026
  15. Patrick SteinhardtMay 22, 2026
  16. Junio C HamanoMay 22, 2026
  17. Patrick SteinhardtMay 22, 2026
  18. 0/8 setup: centralize object database creationPatrick Steinhardt, Jun 4, 2026
  19. 1/8 t0001: plug test gaps for git-init(1) with GIT_OBJECT_DIRECTORYPatrick Steinhardt, Jun 4, 2026
  20. 2/8 setup: drop `setup_git_env()`Patrick Steinhardt, Jun 4, 2026
  21. 3/8 setup: deduplicate logic to apply repository formatPatrick Steinhardt, Jun 4, 2026
  22. 4/8 repository: stop initializing the object database in `repo_set_gitdir()`Patrick Steinhardt, Jun 4, 2026
  23. 5/8 setup: stop creating the object database in `setup_git_env()`Patrick Steinhardt, Jun 4, 2026
  24. 6/8 setup: stop initializing object database without repositoryPatrick Steinhardt, Jun 4, 2026
  25. 7/8 repository: stop reading loose object map twice on repo initPatrick Steinhardt, Jun 4, 2026
  26. 8/8 setup: construct object database in `apply_repository_format()`Patrick Steinhardt, Jun 4, 2026
  27. Karthik NayakJun 5, 2026
  28. Junio C HamanoJun 8, 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.