]> git.ipfire.org Git - thirdparty/git.git/commit
setup: stop creating the object database in `setup_git_env()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 26 May 2026 05:57:00 +0000 (07:57 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 26 May 2026 11:07:02 +0000 (20:07 +0900)
commit414cebbeb78e25f84e8677e72beab2548bae26b9
treef944df724667fec445e407a432269b9479ad7b50
parent56d8ff4aa9f8df1d0c4f010c28039e195497a7fc
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