summaryrefslogtreecommitdiffstats
path: root/tests/staged_files_only_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-13 05:42:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-13 05:42:40 +0000
commitee37d9769800c5482ee0a70b3af41b28a39f4c53 (patch)
tree6c3df8aac260fbcbfb856dbc2ff029a66ad54898 /tests/staged_files_only_test.py
parentReleasing debian version 3.6.0-2. (diff)
downloadpre-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 'tests/staged_files_only_test.py')
-rw-r--r--tests/staged_files_only_test.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/staged_files_only_test.py b/tests/staged_files_only_test.py
index 58dbe5a..cd2f638 100644
--- a/tests/staged_files_only_test.py
+++ b/tests/staged_files_only_test.py
@@ -358,6 +358,21 @@ def test_crlf(in_git_dir, patch_dir, crlf_before, crlf_after, autocrlf):
assert_no_diff()
+@pytest.mark.parametrize('autocrlf', ('true', 'input'))
+def test_crlf_diff_only(in_git_dir, patch_dir, autocrlf):
+ # due to a quirk (?) in git -- a diff only in crlf does not show but
+ # still results in an exit code of `1`
+ # we treat this as "no diff" -- though ideally it would discard the diff
+ # while committing
+ cmd_output('git', 'config', '--local', 'core.autocrlf', autocrlf)
+
+ _write(b'1\r\n2\r\n3\r\n')
+ cmd_output('git', 'add', 'foo')
+ _write(b'1\n2\n3\n')
+ with staged_files_only(patch_dir):
+ pass
+
+
def test_whitespace_errors(in_git_dir, patch_dir):
cmd_output('git', 'config', '--local', 'apply.whitespace', 'error')
test_crlf(in_git_dir, patch_dir, True, True, 'true')