support 'diff-only' hooks by passing diff via stdin (#1279)

This commit is contained in:
Ofer Koren 2020-01-12 21:18:56 +02:00
parent b2faf339ce
commit 4b7f832122
4 changed files with 20 additions and 5 deletions

View file

@ -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)