diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-13 05:42:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-02-13 05:42:40 +0000 |
commit | ee37d9769800c5482ee0a70b3af41b28a39f4c53 (patch) | |
tree | 6c3df8aac260fbcbfb856dbc2ff029a66ad54898 /pre_commit/staged_files_only.py | |
parent | Releasing debian version 3.6.0-2. (diff) | |
download | pre-commit-ee37d9769800c5482ee0a70b3af41b28a39f4c53.tar.xz pre-commit-ee37d9769800c5482ee0a70b3af41b28a39f4c53.zip |
Merging upstream version 3.6.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/staged_files_only.py')
-rw-r--r-- | pre_commit/staged_files_only.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pre_commit/staged_files_only.py b/pre_commit/staged_files_only.py index fd28e1c..e1f81ba 100644 --- a/pre_commit/staged_files_only.py +++ b/pre_commit/staged_files_only.py @@ -59,6 +59,11 @@ def _unstaged_changes_cleared(patch_dir: str) -> Generator[None, None, None]: # There weren't any staged files so we don't need to do anything # special yield + elif retcode == 1 and not diff_stdout.strip(): + # due to behaviour (probably a bug?) in git with crlf endings and + # autocrlf set to either `true` or `input` sometimes git will refuse + # to show a crlf-only diff to us :( + yield elif retcode == 1 and diff_stdout.strip(): patch_filename = f'patch{int(time.time())}-{os.getpid()}' patch_filename = os.path.join(patch_dir, patch_filename) |