mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Use in_git_dir in more places
This commit is contained in:
parent
2af0b0b4f3
commit
d46bbc486f
7 changed files with 88 additions and 143 deletions
|
|
@ -421,17 +421,14 @@ def test_replace_old_commit_script(tempdir_factory, store):
|
|||
assert NORMAL_PRE_COMMIT_RUN.match(output)
|
||||
|
||||
|
||||
def test_uninstall_doesnt_remove_not_our_hooks(tempdir_factory):
|
||||
path = git_dir(tempdir_factory)
|
||||
with cwd(path):
|
||||
mkdirp(os.path.join(path, '.git/hooks'))
|
||||
with io.open(os.path.join(path, '.git/hooks/pre-commit'), 'w') as f:
|
||||
f.write('#!/usr/bin/env bash\necho 1\n')
|
||||
make_executable(f.name)
|
||||
def test_uninstall_doesnt_remove_not_our_hooks(in_git_dir):
|
||||
pre_commit = in_git_dir.join('.git/hooks').ensure_dir().join('pre-commit')
|
||||
pre_commit.write('#!/usr/bin/env bash\necho 1\n')
|
||||
make_executable(pre_commit.strpath)
|
||||
|
||||
assert uninstall() == 0
|
||||
assert uninstall() == 0
|
||||
|
||||
assert os.path.exists(os.path.join(path, '.git/hooks/pre-commit'))
|
||||
assert pre_commit.exists()
|
||||
|
||||
|
||||
PRE_INSTALLED = re.compile(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue