]> git.ipfire.org Git - thirdparty/git.git/commit
setup: stop using `the_repository` in `is_inside_work_tree()`
authorPatrick Steinhardt <ps@pks.im>
Tue, 19 May 2026 09:52:07 +0000 (11:52 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 May 2026 10:36:23 +0000 (19:36 +0900)
commit8da5ecdb4d72594ee126e949bfe813c0f89fe692
tree705611b501e24dace5f39598dde5b8578b476f16
parentce70cbc294f2f1f9a853307d35a78baa16207e58
setup: stop using `the_repository` in `is_inside_work_tree()`

Similar as with the preceding commit, `is_inside_work_tree()` determines
whether the current working directory is located inside the worktree of
`the_repository`. Perform the same refactoring by dropping the caching
mechanism and injecting the repository that shall be checked.

Note that, same as in the preceding commit, we're also resolving the
worktree path via `realpath()`. In theory this step is not necessary as
we always set the worktree path via `repo_set_worktree()`, and that
function already resolves the path for us. But resolving the path a
second time is unlikely to matter performance-wise, and it feels fragile
to rely on the repository's worktree path being absolute. We thus
perform the same extra step even though it's ultimately not required.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-files.c
builtin/rev-parse.c
object-name.c
setup.c
setup.h
submodule.c