Pre-commit stashes unstaged changes on run. Closes #30.

This commit is contained in:
Anthony Sottile 2014-04-05 22:01:29 -07:00
parent a3720c0645
commit 158a3a6d8b
2 changed files with 20 additions and 7 deletions

View file

@ -11,6 +11,7 @@ from pre_commit import commands
from pre_commit import git
from pre_commit.logging_handler import LoggingHandler
from pre_commit.runner import Runner
from pre_commit.staged_files_only import staged_files_only
from pre_commit.util import entry
@ -89,10 +90,11 @@ def _run(runner, args):
logger.addHandler(LoggingHandler(args.color))
logger.setLevel(logging.INFO)
if args.hook:
return run_single_hook(runner, args.hook, args)
else:
return run_hooks(runner, args)
with staged_files_only(runner.cmd_runner):
if args.hook:
return run_single_hook(runner, args.hook, args)
else:
return run_hooks(runner, args)
@entry