]> Kevux Git Server - rit/commit
setup: stop creating the object database in `setup_git_env()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 4 Jun 2026 07:46:29 +0000 (09:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Jun 2026 12:49:38 +0000 (21:49 +0900)
commitaae4ebc895272dc7e5a9ccfc135878b55c7322d7
tree5449eea7704fb8719ab66f07947fd04157433004
parent6a2fbab4c95b0fc317514ec7ead618b3b37e3553
setup: stop creating the object database in `setup_git_env()`

In the preceding commit we have stopped creating the object database in
`repo_set_gitdir()`. But the logic is still somewhat confusing as we
still end up creating it conditionally in `setup_git_dir()`, which is
called multiple times.

Drop the conditional logic and instead create the object database in all
places where we have discovered and configured a repository.

This leads to even more duplication than we already had in the preceding
commit, but an alert reader may notice that we now (almost) always call
`odb_new()` directly before having called `apply_repository_format()`.
The only exception to this is `setup_git_directory_gently()`, where we
also call the function when _not_ applying the repository format. This
will be fixed in the next commit, and once that's done we can then unify
creation of the object database into `apply_repository_format()`.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c