]> git.ipfire.org Git - thirdparty/git.git/commit
setup: pass worktree to `init_db()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 30 Jun 2026 11:47:51 +0000 (13:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Jun 2026 18:29:41 +0000 (11:29 -0700)
commite057c8cba55a35c5ae18fa12841e40b803170382
tree8b9008bbec9c0ba623108e880c1045bd127ddcfa
parentc00fcc75bafce2231479ed33ac6d8d36cc960bfb
setup: pass worktree to `init_db()`

In the preceding commits we have refactored how we discover and set up
repositories so that we cannot end up with partially-configured repos.
Instead, we apply the gitdir, worktree and repository format in a single
location, only.

Initializing a new repository has the same antipattern though: while
most of the information for the new repository is passed via parameters,
the work tree is instead propagated by configuring the repository's work
tree.

Refactor the code so that we also pass the work tree as an explicit
parameter. Like this, configuration fo the repository happens in a
single spot, too, just as with repository discovery.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
builtin/init-db.c
setup.c
setup.h