mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #1051 from mandarvaze/master
Pass color option to git diff (on failure)
This commit is contained in:
commit
a75fe69984
2 changed files with 14 additions and 1 deletions
|
|
@ -224,7 +224,13 @@ def _run_hooks(config, hooks, args, environ):
|
||||||
'`pre-commit install`.',
|
'`pre-commit install`.',
|
||||||
)
|
)
|
||||||
output.write_line('All changes made by hooks:')
|
output.write_line('All changes made by hooks:')
|
||||||
subprocess.call(('git', '--no-pager', 'diff', '--no-ext-diff'))
|
# args.color is a boolean.
|
||||||
|
# See user_color function in color.py
|
||||||
|
subprocess.call((
|
||||||
|
'git', '--no-pager', 'diff', '--no-ext-diff',
|
||||||
|
'--color={}'.format({True: 'always', False: 'never'}[args.color]),
|
||||||
|
))
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,13 @@ def test_global_exclude(cap_out, store, tempdir_factory):
|
||||||
},
|
},
|
||||||
b'All changes made by hooks:',
|
b'All changes made by hooks:',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
{
|
||||||
|
'show_diff_on_failure': True,
|
||||||
|
'color': True,
|
||||||
|
},
|
||||||
|
b'All changes made by hooks:',
|
||||||
|
),
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
'show_diff_on_failure': True,
|
'show_diff_on_failure': True,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue