mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 10:01:46 +04:00
Making it possible to invoke pre-commit run --files some.file from a subdirectory of the repository
This commit is contained in:
parent
894862462d
commit
df8102f57d
4 changed files with 72 additions and 29 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue