surround filenames containing whitespace with quotes by phisko · Pull Request #2119 · pre-commit/pre-commit · GitHub
Skip to content

surround filenames containing whitespace with quotes - #2119

Closed
phisko wants to merge 2 commits into
pre-commit:masterfrom
phisko:master
Closed

phisko wants to merge 2 commits into
pre-commit:masterfrom
phisko:master

Conversation

@phisko

@phisko phisko commented Nov 3, 2021

Copy link
Copy Markdown

Filenames containing spaces are currently appended "as-is" to the command-line arguments for hooks, resulting in situations like this:

  • Files:
  1. source.cpp
  2. other file.cpp
  • Command line:
my_hook.sh source.cpp other file.cpp

This makes it impossible to differentiate filenames from within the hook. Simply adding quotes around filenames fixes the issue

@phisko phisko closed this Nov 3, 2021
@asottile

asottile commented Nov 3, 2021

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants