mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Separate store from runner
This commit is contained in:
parent
6d683a5fac
commit
c01ffc83f8
15 changed files with 228 additions and 347 deletions
|
|
@ -20,10 +20,11 @@ def try_repo(args):
|
|||
ref = args.ref or git.head_rev(args.repo)
|
||||
|
||||
with tmpdir() as tempdir:
|
||||
store = Store(tempdir)
|
||||
if args.hook:
|
||||
hooks = [{'id': args.hook}]
|
||||
else:
|
||||
repo_path = Store(tempdir).clone(args.repo, ref)
|
||||
repo_path = store.clone(args.repo, ref)
|
||||
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
|
||||
manifest = sorted(manifest, key=lambda hook: hook['id'])
|
||||
hooks = [{'id': hook['id']} for hook in manifest]
|
||||
|
|
@ -42,5 +43,4 @@ def try_repo(args):
|
|||
output.write(config_s)
|
||||
output.write_line('=' * 79)
|
||||
|
||||
runner = Runner('.', config_filename, store_dir=tempdir)
|
||||
return run(runner, args)
|
||||
return run(Runner('.', config_filename), store, args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue