summaryrefslogtreecommitdiffstats
path: root/tests/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-08 04:17:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-08 04:17:14 +0000
commit638cb1489a90410c2e1502903c1a806c5ebe8587 (patch)
tree5df02a4562e54b985b698b1974ce6d7219ffdf49 /tests/commands
parentReleasing debian version 3.0.3-1. (diff)
downloadpre-commit-638cb1489a90410c2e1502903c1a806c5ebe8587.tar.xz
pre-commit-638cb1489a90410c2e1502903c1a806c5ebe8587.zip
Merging upstream version 3.0.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/run_test.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 03d741e..f1085d9 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -766,6 +766,47 @@ def test_lots_of_files(store, tempdir_factory):
)
+def test_no_textconv(cap_out, store, repo_with_passing_hook):
+ # git textconv filters can hide changes from hooks
+ with open('.gitattributes', 'w') as fp:
+ fp.write('*.jpeg diff=empty\n')
+
+ with open('.git/config', 'a') as fp:
+ fp.write('[diff "empty"]\n')
+ fp.write('textconv = "true"\n')
+
+ config = {
+ 'repo': 'local',
+ 'hooks': [
+ {
+ 'id': 'extend-jpeg',
+ 'name': 'extend-jpeg',
+ 'language': 'system',
+ 'entry': (
+ f'{shlex.quote(sys.executable)} -c "import sys; '
+ 'open(sys.argv[1], \'ab\').write(b\'\\x00\')"'
+ ),
+ 'types': ['jpeg'],
+ },
+ ],
+ }
+ add_config_to_repo(repo_with_passing_hook, config)
+
+ stage_a_file('example.jpeg')
+
+ _test_run(
+ cap_out,
+ store,
+ repo_with_passing_hook,
+ {},
+ (
+ b'Failed',
+ ),
+ expected_ret=1,
+ stage=False,
+ )
+
+
def test_stages(cap_out, store, repo_with_passing_hook):
config = {
'repo': 'local',