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