From 16bc739ce722fe218ebe54b758a8dc46a4745984 Mon Sep 17 00:00:00 2001 From: Pujit Mehrotra Date: Fri, 19 Nov 2021 12:13:37 -0500 Subject: [PATCH] Suggest usable call when exec files lack shebang on Windows Resolves Issue #686 --- pre_commit_hooks/check_executables_have_shebangs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pre_commit_hooks/check_executables_have_shebangs.py b/pre_commit_hooks/check_executables_have_shebangs.py index 33f75c02..34af5cac 100644 --- a/pre_commit_hooks/check_executables_have_shebangs.py +++ b/pre_commit_hooks/check_executables_have_shebangs.py @@ -64,6 +64,8 @@ def _message(path: str) -> None: f'{path}: marked executable but has no (or invalid) shebang!\n' f" If it isn't supposed to be executable, try: " f'`chmod -x {shlex.quote(path)}`\n' + f' If on Windows, you may also need to: ' + f'`git add --chmod=-x {shlex.quote(path)}`\n' f' If it is supposed to be executable, double-check its shebang.', file=sys.stderr, )