diff --git a/pre_commit/commands/run.py b/pre_commit/commands/run.py index 2714faf4..d8b5aeae 100644 --- a/pre_commit/commands/run.py +++ b/pre_commit/commands/run.py @@ -109,6 +109,12 @@ class Classifier: hook.types_or, hook.exclude_types, ) + + # surround filenames containing whitespace with quotes + for f in names: + if re.search(r"\s", f): + f = '"' + f + '"' + return tuple(names) @classmethod