Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 64f0178

Browse files
committed
Pass color option to git diff unconditionally
1 parent 4f4767c commit 64f0178

2 files changed

Lines changed: 5 additions & 13 deletions

File tree

pre_commit/commands/run.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,10 @@ def _run_hooks(config, hooks, args, environ):
224224
'`pre-commit install`.',
225225
)
226226
output.write_line('All changes made by hooks:')
227-
if args.color:
228-
subprocess.call((
229-
'git', '--no-pager', 'diff', '--no-ext-diff',
230-
'--color={}'.format(args.color),
231-
))
232-
else:
233-
subprocess.call(('git', '--no-pager', 'diff', '--no-ext-diff'))
227+
subprocess.call((
228+
'git', '--no-pager', 'diff', '--no-ext-diff',
229+
'--color={}'.format(args.color),
230+
))
234231

235232
return retval
236233

tests/commands/run_test.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ def test_global_exclude(cap_out, store, tempdir_factory):
181181
@pytest.mark.parametrize(
182182
('args', 'expected_out'),
183183
[
184-
(
185-
{
186-
'show_diff_on_failure': True,
187-
},
188-
b'All changes made by hooks:',
189-
),
190184
(
191185
{
192186
'show_diff_on_failure': True,
@@ -198,6 +192,7 @@ def test_global_exclude(cap_out, store, tempdir_factory):
198192
{
199193
'show_diff_on_failure': True,
200194
'all_files': True,
195+
'color': 'auto',
201196
},
202197
b'reproduce locally with: pre-commit run --all-files',
203198
),

0 commit comments

Comments
 (0)