[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2024-03-14 12:02:07 +00:00
parent fd1cfc60bf
commit 0b468953be
2 changed files with 4 additions and 4 deletions

View file

@ -76,13 +76,13 @@ def _install_hook_script(
# If the hooks directory links to a directory outside the
# git repo we shouldn't try to mess with it
if os.path.commonpath(
[os.path.realpath(git_dir), os.path.realpath(hook_path)]
) != os.path.realpath(git_dir):
[os.path.realpath(git_dir), os.path.realpath(hook_path)],
) != os.path.realpath(git_dir):
logger.error(
'Cowardly refusing to install hook script to a directory '
'outside of the git repo.\n'
f'hint: {os.path.dirname(hook_path)} is a symbolic link '
f'to {os.path.realpath(os.path.dirname(hook_path))}.'
f'to {os.path.realpath(os.path.dirname(hook_path))}.',
)
return 1

View file

@ -111,7 +111,7 @@ def test_install_hooks_dead_symlink(in_git_dir, store):
def test_install_hooks_symlink_outisde_git_repo(in_git_dir, store):
hook_dir = in_git_dir.join('.git/hooks')
hook_dir.mksymlinkto(in_git_dir.join("../hooks"))
hook_dir.mksymlinkto(in_git_dir.join('../hooks'))
hook = hook_dir.join('pre-commit')
assert install(C.CONFIG_FILE, store, hook_types=['pre-commit']) != 0
assert not hook.exists()