mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-16 02:21:46 +04:00
support 'diff-only' hooks by passing diff via stdin (#1279)
This commit is contained in:
parent
b2faf339ce
commit
4b7f832122
4 changed files with 20 additions and 5 deletions
|
|
@ -106,4 +106,8 @@ def run_xargs(
|
|||
# but do it deterministically in case a hook cares about ordering.
|
||||
file_args = _shuffled(file_args)
|
||||
kwargs['target_concurrency'] = target_concurrency(hook)
|
||||
if hook.pass_diff:
|
||||
input_data, = file_args
|
||||
kwargs['input_data'] = input_data
|
||||
file_args = ()
|
||||
return xargs(cmd, file_args, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue