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_test.py | ||
| check_ast_test.py | ||
| check_builtin_literals_test.py | ||
| check_byte_order_marker_test.py | ||
| check_case_conflict_test.py | ||
| check_docstring_first_test.py | ||
| check_executables_have_shebangs_test.py | ||
| check_json_test.py | ||
| check_merge_conflict_test.py | ||
| check_symlinks_test.py | ||
| check_toml_test.py | ||
| check_vcs_permalinks_test.py | ||
| check_xml_test.py | ||
| check_yaml_test.py | ||
| conftest.py | ||
| debug_statement_hook_test.py | ||
| detect_aws_credentials_test.py | ||
| detect_private_key_test.py | ||
| end_of_file_fixer_test.py | ||
| file_contents_sorter_test.py | ||
| fix_encoding_pragma_test.py | ||
| forbid_new_submodules_test.py | ||
| mixed_line_ending_test.py | ||
| no_commit_to_branch_test.py | ||
| pretty_format_json_test.py | ||
| readme_test.py | ||
| removed_test.py | ||
| requirements_txt_fixer_test.py | ||
| sort_simple_yaml_test.py | ||
| string_fixer_test.py | ||
| tests_should_end_in_test_test.py | ||
| trailing_whitespace_fixer_test.py | ||
| util_test.py | ||