Resolves cwd problem

This commit is contained in:
Anthony Sottile 2014-03-29 23:23:43 -07:00
parent 6f0d566199
commit 216b5c6ab1
13 changed files with 212 additions and 107 deletions

View file

@ -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,