mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-20 01:24:42 +04:00
Pass color option to git diff unconditionally
This commit is contained in:
parent
4f4767c9e0
commit
64f0178b75
2 changed files with 5 additions and 13 deletions
|
|
@ -224,13 +224,10 @@ 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:')
|
||||||
if args.color:
|
|
||||||
subprocess.call((
|
subprocess.call((
|
||||||
'git', '--no-pager', 'diff', '--no-ext-diff',
|
'git', '--no-pager', 'diff', '--no-ext-diff',
|
||||||
'--color={}'.format(args.color),
|
'--color={}'.format(args.color),
|
||||||
))
|
))
|
||||||
else:
|
|
||||||
subprocess.call(('git', '--no-pager', 'diff', '--no-ext-diff'))
|
|
||||||
|
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,12 +181,6 @@ def test_global_exclude(cap_out, store, tempdir_factory):
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
('args', 'expected_out'),
|
('args', 'expected_out'),
|
||||||
[
|
[
|
||||||
(
|
|
||||||
{
|
|
||||||
'show_diff_on_failure': True,
|
|
||||||
},
|
|
||||||
b'All changes made by hooks:',
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
{
|
{
|
||||||
'show_diff_on_failure': True,
|
'show_diff_on_failure': True,
|
||||||
|
|
@ -198,6 +192,7 @@ 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