mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Resolves cwd problem
This commit is contained in:
parent
6f0d566199
commit
216b5c6ab1
13 changed files with 212 additions and 107 deletions
|
|
@ -18,9 +18,7 @@ COLS = int(subprocess.Popen(['tput', 'cols'], stdout=subprocess.PIPE).communicat
|
|||
PASS_FAIL_LENGTH = 6
|
||||
|
||||
|
||||
def _run_single_hook(repository, hook_id, all_files=False):
|
||||
repository.install()
|
||||
|
||||
def _run_single_hook(runner, repository, hook_id, all_files=False):
|
||||
if all_files:
|
||||
get_filenames = git.get_all_files_matching
|
||||
else:
|
||||
|
|
@ -36,6 +34,7 @@ def _run_single_hook(repository, hook_id, all_files=False):
|
|||
),
|
||||
|
||||
retcode, stdout, stderr = repository.run_hook(
|
||||
runner.cmd_runner,
|
||||
hook_id,
|
||||
map(os.path.abspath, get_filenames(hook['files'])),
|
||||
)
|
||||
|
|
@ -69,6 +68,7 @@ def run_hooks(runner, all_files=False):
|
|||
for repo in runner.repositories:
|
||||
for hook_id in repo.hooks:
|
||||
retval |= _run_single_hook(
|
||||
runner,
|
||||
repo,
|
||||
hook_id,
|
||||
all_files=all_files,
|
||||
|
|
@ -81,6 +81,7 @@ def run_single_hook(runner, hook_id, all_files=False):
|
|||
for repo in runner.repositories:
|
||||
if hook_id in repo.hooks:
|
||||
return _run_single_hook(
|
||||
runner,
|
||||
repo,
|
||||
hook_id,
|
||||
all_files=all_files,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue