Suggest usable call when executable files lack shebang on Windows by pujitm · Pull Request #689 · pre-commit/pre-commit-hooks
Conversation
Resolves #686
Some of the executable error messages suggest using chmod +/-x to toggle the executable bits. This works fine on *nix, but not on windows, and the results range from 'command not found' to doing nothing at all.
Eg:
f'`chmod -x {shlex.quote(path)}`\n' Instead, this should recommend
git add --chmod=+/-x somepathwhen the hook detects it's running on windows.
Comment on lines +66 to +67
| f'`chmod -x {shlex.quote(path)}`\n' | ||
| f'`{"git add --chmod=-x" if is_windows else "chmod -x"} {shlex.quote(path)}`\n' |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I mean, without having any branching logic just write:
"chmod -x ..."
" if on windows you may also need to ..."
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jmerdich added a commit to jmerdich/pre-commit-hooks that referenced this pull request
Follow-up for pre-commit#686 and pre-commit#689. The previous change resolved when a file was executable but lacked a shebang, but not vice-versa.
