]> git.ipfire.org Git - thirdparty/git.git/commit
environment: move access to "core.hooksPath" into repo settings
authorPatrick Steinhardt <ps@pks.im>
Fri, 7 Feb 2025 11:03:39 +0000 (12:03 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Feb 2025 21:54:11 +0000 (13:54 -0800)
commit6f3fbed8eda577703426d77dacc71ce0ba46634e
tree9203a2881677e2988b315f1e8aed4e84ac13eac0
parentb411ed60c7438eda3fd85a308050e88159f275fd
environment: move access to "core.hooksPath" into repo settings

The "core.hooksPath" setting is stored in a global variable and
populated via the `git_default_core_config`. This may cause issues in
the case where one is handling multiple different repositories in a
single process with different values for that config key, as we may or
may not see the correct value in that case. Furthermore, global state
blocks our path towards libification.

Refactor the code so that we instead store the value in `struct
repo_settings`. The value is computed as-needed and cached. The result
should be functionally the same as there aren't ever any code paths
where we'd execute hooks outside the context of a repository.

Note that this requires us to change the passed-in repository in the
`repo_git_path()` family of functions to be non-constant, as we call
`adjust_git_path()` there.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
environment.c
environment.h
path.c
path.h
repo-settings.c
repo-settings.h