1
0
Fork 0

Adding upstream version 2.5.1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 21:20:03 +01:00
parent 080d7f9289
commit bb6dbf8636
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
37 changed files with 457 additions and 213 deletions

View file

@ -939,7 +939,7 @@ def test_classifier_normalizes_filenames_on_windows_to_forward_slashes(tmpdir):
tmpdir.join('a/b/c').ensure()
with mock.patch.object(os, 'altsep', '/'):
with mock.patch.object(os, 'sep', '\\'):
classifier = Classifier((r'a\b\c',))
classifier = Classifier.from_config((r'a\b\c',), '', '^$')
assert classifier.filenames == ['a/b/c']
@ -947,7 +947,7 @@ def test_classifier_does_not_normalize_backslashes_non_windows(tmpdir):
with mock.patch.object(os.path, 'lexists', return_value=True):
with mock.patch.object(os, 'altsep', None):
with mock.patch.object(os, 'sep', '/'):
classifier = Classifier((r'a/b\c',))
classifier = Classifier.from_config((r'a/b\c',), '', '^$')
assert classifier.filenames == [r'a/b\c']
@ -1022,3 +1022,18 @@ def test_args_hook_only(cap_out, store, repo_with_passing_hook):
run_opts(hook='do_not_commit'),
)
assert b'identity-copy' not in printed
def test_skipped_without_any_setup_for_post_checkout(in_git_dir, store):
environ = {'_PRE_COMMIT_SKIP_POST_CHECKOUT': '1'}
opts = run_opts(hook_stage='post-checkout')
assert run(C.CONFIG_FILE, store, opts, environ=environ) == 0
def test_pre_commit_env_variable_set(cap_out, store, repo_with_passing_hook):
args = run_opts()
environ: EnvironT = {}
ret, printed = _do_run(
cap_out, store, repo_with_passing_hook, args, environ,
)
assert environ['PRE_COMMIT'] == '1'