@@ -388,6 +388,38 @@ def test_skip_hook(cap_out, store, repo_with_passing_hook):
388388 assert msg in printed
389389
390390
391+ def test_skip_aliased_hook (cap_out , store , repo_with_passing_hook ):
392+ with cwd (repo_with_passing_hook ):
393+ # Add bash hook on there again, aliased
394+ with modify_config () as config :
395+ config ['repos' ][0 ]['hooks' ].append (
396+ {'id' : 'bash_hook' , 'alias' : 'foo_bash' },
397+ )
398+ stage_a_file ()
399+
400+ ret , printed = _do_run (
401+ cap_out , store , repo_with_passing_hook ,
402+ run_opts (hook = 'bash_hook' ),
403+ {'SKIP' : 'bash_hook' },
404+ )
405+ assert ret == 0
406+ # Both hooks will run since they share the same ID
407+ assert printed .count (b'Bash hook' ) == 2
408+ for msg in (b'Bash hook' , b'Skipped' ):
409+ assert msg in printed
410+
411+ ret , printed = _do_run (
412+ cap_out , store , repo_with_passing_hook ,
413+ run_opts (hook = 'foo_bash' ),
414+ {'SKIP' : 'foo_bash' },
415+ )
416+ assert ret == 0
417+ # Only the aliased hook runs
418+ assert printed .count (b'Bash hook' ) == 1
419+ for msg in (b'Bash hook' , b'Skipped' ):
420+ assert msg in printed , printed
421+
422+
391423def test_hook_id_not_in_non_verbose_output (
392424 cap_out , store , repo_with_passing_hook ,
393425):
0 commit comments