mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Adding support for locally-defined hooks
This commit is contained in:
parent
d97ea30c4b
commit
b68261c720
8 changed files with 241 additions and 40 deletions
|
|
@ -60,12 +60,16 @@ def write_config(directory, config):
|
|||
config_file.write(ordered_dump([config], **C.YAML_DUMP_KWARGS))
|
||||
|
||||
|
||||
def make_consuming_repo(tmpdir_factory, repo_source):
|
||||
path = make_repo(tmpdir_factory, repo_source)
|
||||
config = make_config_from_repo(path)
|
||||
git_path = git_dir(tmpdir_factory)
|
||||
def add_config_to_repo(git_path, config):
|
||||
write_config(git_path, config)
|
||||
with cwd(git_path):
|
||||
cmd_output('git', 'add', C.CONFIG_FILE)
|
||||
cmd_output('git', 'commit', '-m', 'Add hooks config')
|
||||
return git_path
|
||||
|
||||
|
||||
def make_consuming_repo(tmpdir_factory, repo_source):
|
||||
path = make_repo(tmpdir_factory, repo_source)
|
||||
config = make_config_from_repo(path)
|
||||
git_path = git_dir(tmpdir_factory)
|
||||
return add_config_to_repo(git_path, config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue