add helpful message and test

This commit is contained in:
Ben Norquist
2019-03-26 22:31:44 -07:00
committed by Anthony Sottile
parent 03ac3b0840
commit 71a740d65d
2 changed files with 36 additions and 4 deletions

View File

@@ -215,7 +215,14 @@ def _run_hooks(config, hooks, args, environ):
if retval and config['fail_fast']:
break
if retval and args.show_diff_on_failure and git.has_diff():
output.write_line('All changes made by hooks:')
if args.all_files:
output.write_line(
'Pre-commit hook(s) made changes. '
'If you are seeing this message on CI,'
' reproduce locally with: pre-commit run --all-files',
)
else:
output.write_line('All changes made by hooks:')
subprocess.call(('git', '--no-pager', 'diff', '--no-ext-diff'))
return retval