mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
fd1cfc60bf
commit
0b468953be
2 changed files with 4 additions and 4 deletions
|
|
@ -76,13 +76,13 @@ def _install_hook_script(
|
||||||
# If the hooks directory links to a directory outside the
|
# If the hooks directory links to a directory outside the
|
||||||
# git repo we shouldn't try to mess with it
|
# git repo we shouldn't try to mess with it
|
||||||
if os.path.commonpath(
|
if os.path.commonpath(
|
||||||
[os.path.realpath(git_dir), os.path.realpath(hook_path)]
|
[os.path.realpath(git_dir), os.path.realpath(hook_path)],
|
||||||
) != os.path.realpath(git_dir):
|
) != os.path.realpath(git_dir):
|
||||||
logger.error(
|
logger.error(
|
||||||
'Cowardly refusing to install hook script to a directory '
|
'Cowardly refusing to install hook script to a directory '
|
||||||
'outside of the git repo.\n'
|
'outside of the git repo.\n'
|
||||||
f'hint: {os.path.dirname(hook_path)} is a symbolic link '
|
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
|
return 1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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):
|
def test_install_hooks_symlink_outisde_git_repo(in_git_dir, store):
|
||||||
hook_dir = in_git_dir.join('.git/hooks')
|
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')
|
hook = hook_dir.join('pre-commit')
|
||||||
assert install(C.CONFIG_FILE, store, hook_types=['pre-commit']) != 0
|
assert install(C.CONFIG_FILE, store, hook_types=['pre-commit']) != 0
|
||||||
assert not hook.exists()
|
assert not hook.exists()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue