mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Pass correct value to git color based on args.color
This commit is contained in:
parent
64f0178b75
commit
3d7b374bef
2 changed files with 10 additions and 3 deletions
|
|
@ -224,9 +224,11 @@ 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:')
|
||||||
|
# args.color is a boolean.
|
||||||
|
# See user_color function in color.py
|
||||||
subprocess.call((
|
subprocess.call((
|
||||||
'git', '--no-pager', 'diff', '--no-ext-diff',
|
'git', '--no-pager', 'diff', '--no-ext-diff',
|
||||||
'--color={}'.format(args.color),
|
'--color={}'.format({True: 'always', False: 'never'}[args.color]),
|
||||||
))
|
))
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,13 @@ def test_global_exclude(cap_out, store, tempdir_factory):
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
'show_diff_on_failure': True,
|
'show_diff_on_failure': True,
|
||||||
'color': 'auto',
|
},
|
||||||
|
b'All changes made by hooks:',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
{
|
||||||
|
'show_diff_on_failure': True,
|
||||||
|
'color': True,
|
||||||
},
|
},
|
||||||
b'All changes made by hooks:',
|
b'All changes made by hooks:',
|
||||||
),
|
),
|
||||||
|
|
@ -192,7 +198,6 @@ def test_global_exclude(cap_out, store, tempdir_factory):
|
||||||
{
|
{
|
||||||
'show_diff_on_failure': True,
|
'show_diff_on_failure': True,
|
||||||
'all_files': True,
|
'all_files': True,
|
||||||
'color': 'auto',
|
|
||||||
},
|
},
|
||||||
b'reproduce locally with: pre-commit run --all-files',
|
b'reproduce locally with: pre-commit run --all-files',
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue