test_expect_code 129 git hook &&
test_expect_code 129 git hook run &&
test_expect_code 129 git hook run -h &&
- test_expect_code 129 git hook list -h &&
test_expect_code 129 git hook run --unknown 2>err &&
test_expect_code 129 git hook list &&
test_expect_code 129 git hook list -h &&
test_cmp expected actual
'
+test_expect_success 'configured hooks run before hookdir hook' '
+ setup_hookdir &&
+ test_config hook.first.event "pre-commit" &&
+ test_config hook.first.command "echo first" &&
+ test_config hook.second.event "pre-commit" &&
+ test_config hook.second.command "echo second" &&
+
+ cat >expected <<-\EOF &&
+ first
+ second
+ hook from hookdir
+ EOF
+
+ git hook list pre-commit >actual &&
+ test_cmp expected actual &&
+
+ # "Legacy Hook" is the output of the hookdir pre-commit script
+ # written by setup_hookdir() above.
+ cat >expected <<-\EOF &&
+ first
+ second
+ "Legacy Hook"
+ EOF
+
+ git hook run pre-commit 2>actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'git hook run a hook with a bad shebang' '
test_when_finished "rm -rf bad-hooks" &&
mkdir bad-hooks &&