]> Kevux Git Server - rit/commit
repository: stop initializing the object database in `repo_set_gitdir()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 4 Jun 2026 07:46:28 +0000 (09:46 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Jun 2026 12:49:38 +0000 (21:49 +0900)
commit6a2fbab4c95b0fc317514ec7ead618b3b37e3553
treeee6416d9704f1c2d20d4e15a697bb1a803f3b69e
parent3d884b0b5656fe012002edd6bb8f36a125e6c17e
repository: stop initializing the object database in `repo_set_gitdir()`

The function `repo_set_gitdir()` obviously sets the Git directory for a
given repository. Less obviously though, the function also configures a
couple of auxiliary settings.

One such thing is that we create the object database in this function.
This logic only happens conditionally though, as `set_git_dir()` may be
called multiple times during repository setup, and we don't want to
create the object database multiple times. This is somewhat tangled and
hard to follow.

Remove the logic from `repo_set_gitdir()` and instead initialize the
object database outside of it. This leads to some duplication right now,
but that duplication will be removed in a subsequent step where we will
start initializing the object database as part of applying the repo's
format.

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