Allow global core.hooksPath via --allow-global-hooks

This commit is contained in:
Luke Young 2023-09-06 11:34:35 -07:00
parent e2c6a822c7
commit f67f64306b
2 changed files with 14 additions and 1 deletions

View file

@ -118,9 +118,14 @@ def install(
overwrite: bool = False,
hooks: bool = False,
skip_on_missing_config: bool = False,
allow_global_hooks: bool = False,
git_dir: str | None = None,
) -> int:
if git_dir is None and git.has_core_hookpaths_set():
if (
git_dir is None and
git.has_core_hookpaths_set() and
not allow_global_hooks
):
logger.error(
'Cowardly refusing to install hooks with `core.hooksPath` set.\n'
'hint: `git config --unset-all core.hooksPath`',