mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 18:16:52 +00:00
On Windows, all files are "executable". Therefore, to know if a file is supposed to be executed, we check how its attributes were recorded by git: we run a `git ls-files` command in a subprocess. By default, this command outputs information on multiple lines (file and their data separated by newlines). When a file contains an unusual character, the character is escaped with an integer sequence (such as `\303\261`), and git wraps the whole filename in double-quotes because of the backslashes. It breaks the current code because we try to open the filename containing the double-quotes: it doesn't exist, of course. Instead of trying to fix this special case by removing the double-quotes, and breaking other cases (a double-quote is a valid filename character on Linux), we tell git to separate each item with the null character `\0` instead of a new line `\n`, with the option `-z`. With this option, git doesn't escape unusual characters with integer sequence, so the output is fixed, and we parse it by splitting on `\0` instead of `\n`. Fixes #508. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| check_added_large_files.py | ||
| check_ast.py | ||
| check_builtin_literals.py | ||
| check_byte_order_marker.py | ||
| check_case_conflict.py | ||
| check_docstring_first.py | ||
| check_executables_have_shebangs.py | ||
| check_json.py | ||
| check_merge_conflict.py | ||
| check_symlinks.py | ||
| check_toml.py | ||
| check_vcs_permalinks.py | ||
| check_xml.py | ||
| check_yaml.py | ||
| debug_statement_hook.py | ||
| detect_aws_credentials.py | ||
| detect_private_key.py | ||
| end_of_file_fixer.py | ||
| file_contents_sorter.py | ||
| fix_encoding_pragma.py | ||
| forbid_new_submodules.py | ||
| mixed_line_ending.py | ||
| no_commit_to_branch.py | ||
| pretty_format_json.py | ||
| removed.py | ||
| requirements_txt_fixer.py | ||
| sort_simple_yaml.py | ||
| string_fixer.py | ||
| tests_should_end_in_test.py | ||
| trailing_whitespace_fixer.py | ||
| util.py | ||