Making it possible to invoke pre-commit run --files some.file from a subdirectory of the repository

This commit is contained in:
Lucas Cimon 2016-02-03 09:03:59 +01:00
parent 894862462d
commit df8102f57d
4 changed files with 72 additions and 29 deletions

View file

@ -110,8 +110,14 @@ def add_config_to_repo(git_path, config):
return git_path
def make_consuming_repo(tempdir_factory, repo_source):
def make_consuming_repo(tempdir_factory, repo_source, local_hooks=None):
path = make_repo(tempdir_factory, repo_source)
config = make_config_from_repo(path)
if local_hooks:
config = OrderedDict((
('repo', 'local'),
('hooks', local_hooks),
))
else:
config = make_config_from_repo(path)
git_path = git_dir(tempdir_factory)
return add_config_to_repo(git_path, config)