mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-18 08:34:41 +04:00
Add guard against the hooks directory being a symbolic link
`pre-commit install` shouldn't mess with directories residing outside of the git repository.
This commit is contained in:
parent
3bdf9fb91b
commit
fd1cfc60bf
2 changed files with 28 additions and 1 deletions
|
|
@ -109,6 +109,14 @@ def test_install_hooks_dead_symlink(in_git_dir, store):
|
|||
assert hook.exists()
|
||||
|
||||
|
||||
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 = hook_dir.join('pre-commit')
|
||||
assert install(C.CONFIG_FILE, store, hook_types=['pre-commit']) != 0
|
||||
assert not hook.exists()
|
||||
|
||||
|
||||
def test_uninstall_does_not_blow_up_when_not_there(in_git_dir):
|
||||
assert uninstall(C.CONFIG_FILE, hook_types=['pre-commit']) == 0
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue