summaryrefslogtreecommitdiff
path: root/t/t4013/diff.diff_initial..side
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2026-06-11 08:44:39 +0200
committerJunio C Hamano <gitster@pobox.com>2026-06-11 05:05:54 -0700
commit9bef2cf33111dc844e46a8a19c266320774f4bd6 (patch)
treec17a01a2170c50d43b20fe7d1a749e29b61bcd3c /t/t4013/diff.diff_initial..side
parent36bafa0b6582e0968d33d48cf3a1eaa29ceb6661 (diff)
builtin/init: stop modifying global `git_work_tree_cfg` variable
When executing git-init(1) we need to figure out the final location of the worktree. This location can be configured in a couple of ways: via an environment variable, via the preexisting "core.worktree" config in case we're reinitializing, or implicitly when reinitializing a non-bare repository. When checking for the worktree location in "builtin/init-db.c" we populate any potentially-discovered value both by setting the global `git_work_tree_cfg` variable and via `set_git_work_tree()`, which ultimately ends up modifying `struct repository::worktree`. Modifying `git_work_tree_cfg` is unnecessary though: we configure the worktree in `create_default_files()`, and that function derives the worktree location via `repo_get_work_tree()`. Consequently, propagating the worktree via `set_git_work_tree()` is sufficient. Stop munging `git_work_tree_cfg` and make it file-local to "setup.c" and function-local to `cmd_init_db()`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions