From cd6d19fe40fb7e719bf596e3961afff8f890b0c5 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 26 May 2022 16:38:45 +0200 Subject: [PATCH] Update help for 'chmod' changes for shebang scripts on Windows --- pre_commit_hooks/check_executables_have_shebangs.py | 2 +- pre_commit_hooks/check_shebang_scripts_are_executable.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pre_commit_hooks/check_executables_have_shebangs.py b/pre_commit_hooks/check_executables_have_shebangs.py index d8e4f490..c2cfa184 100644 --- a/pre_commit_hooks/check_executables_have_shebangs.py +++ b/pre_commit_hooks/check_executables_have_shebangs.py @@ -67,7 +67,7 @@ def _message(path: str) -> None: 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'`git update-index --chmod=-x {shlex.quote(path)}`\n' f' If it is supposed to be executable, double-check its shebang.', file=sys.stderr, ) diff --git a/pre_commit_hooks/check_shebang_scripts_are_executable.py b/pre_commit_hooks/check_shebang_scripts_are_executable.py index 0f35650b..7566c1a2 100644 --- a/pre_commit_hooks/check_shebang_scripts_are_executable.py +++ b/pre_commit_hooks/check_shebang_scripts_are_executable.py @@ -34,6 +34,8 @@ def _message(path: str) -> None: f'{path}: has a shebang but is not marked executable!\n' f' If it is supposed to be executable, try: ' f'`chmod +x {shlex.quote(path)}`\n' + f' If on Windows, you may also need to: ' + f'`git update-index --chmod=+x {shlex.quote(path)}`\n' f' If it not supposed to be executable, double-check its shebang ' f'is wanted.\n', file=sys.stderr,