3 test_description='Test the core.hooksPath configuration variable'
7 test_expect_success 'set up a pre-commit hook in core.hooksPath' '
8 mkdir -p .git/custom-hooks .git/hooks &&
9 write_script .git/custom-hooks/pre-commit <<-\EOF &&
12 write_script .git/hooks/pre-commit <<-\EOF
17 test_expect_success 'Check that various forms of specifying core.hooksPath work' '
18 test_commit no_custom_hook &&
19 git config core.hooksPath .git/custom-hooks &&
20 test_commit have_custom_hook &&
21 git config core.hooksPath .git/custom-hooks/ &&
22 test_commit have_custom_hook_trailing_slash &&
23 git config core.hooksPath "$PWD/.git/custom-hooks" &&
24 test_commit have_custom_hook_abs_path &&
25 git config core.hooksPath "$PWD/.git/custom-hooks/" &&
26 test_commit have_custom_hook_abs_path_trailing_slash &&
27 cat >expect <<-\EOF &&
34 test_cmp expect actual
37 test_expect_success 'git rev-parse --git-path hooks' '
38 git config core.hooksPath .git/custom-hooks &&
39 git rev-parse --git-path hooks/abc >actual &&
40 test .git/custom-hooks/abc = "$(cat actual)"