Windows does not have a concept of executable , thus Identify which is used be pre-commit, reports all files as executable on Windows, even if git itself is aware which files are executable.
This makes the script-must-have-extension and script-must-not-have-extension hooks useless on Windows.
pre-commit themselves had the the same problem pre-commit/pre-commit-hooks#435
$ pre-commit run -a
Non-executable shell script filename ends in .sh.......(no files to check)Skipped
Executable shell script omits the filename extension.......................Failed
- hook id: script-must-not-have-extension
- exit code: 1
[ERROR] gut-copy.sh has an extension but should not
[ERROR] gut.sh has an extension but should not
$ identify-cli gut.sh
["executable", "file", "shell", "text"]
$ identify-cli gut-copy.sh
["executable", "file", "shell", "text"]
$ git ls-files -s gut.sh
100755 57765ec5365a5d2da0de57ecb31fbeee2bdbb7d4 0 gut.sh
$ git ls-files -s gut-copy.sh
100644 57765ec5365a5d2da0de57ecb31fbeee2bdbb7d4 0 gut-copy.sh
Windows does not have a concept of
executable
, thus Identify which is used be pre-commit, reports all files as executable on Windows, even if git itself is aware which files are executable. This makes thescript-must-have-extension
andscript-must-not-have-extension
hooks useless on Windows. pre-commit themselves had the the same problem pre-commit/pre-commit-hooks#435