mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Fix coverage and path to repo dir
This commit is contained in:
parent
7923236bb6
commit
42fe699ef4
2 changed files with 11 additions and 2 deletions
|
|
@ -75,9 +75,10 @@ def _install_hook_script(
|
|||
git_dir = git_dir if git_dir is not None else git.get_git_common_dir()
|
||||
# If the hooks directory links to a directory outside the
|
||||
# git repo we shouldn't try to mess with it
|
||||
repo_dir = os.path.dirname(os.path.realpath(git_dir))
|
||||
if os.path.commonpath(
|
||||
[os.path.realpath(git_dir), os.path.realpath(hook_path)],
|
||||
) != os.path.realpath(git_dir):
|
||||
[repo_dir, os.path.realpath(hook_path)]
|
||||
) != repo_dir:
|
||||
logger.error(
|
||||
'Cowardly refusing to install hook script to a directory '
|
||||
'outside of the git repo.\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue