3 test_description
='Test the core.hooksPath configuration variable'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'set up a pre-commit hook in core.hooksPath' '
10 mkdir -p .git/custom-hooks &&
11 write_script .git/custom-hooks/pre-commit <<-\EOF &&
14 test_hook --setup pre-commit <<-\EOF
19 test_expect_success
'Check that various forms of specifying core.hooksPath work' '
20 test_commit no_custom_hook &&
21 git config core.hooksPath .git/custom-hooks &&
22 test_commit have_custom_hook &&
23 git config core.hooksPath .git/custom-hooks/ &&
24 test_commit have_custom_hook_trailing_slash &&
25 git config core.hooksPath "$PWD/.git/custom-hooks" &&
26 test_commit have_custom_hook_abs_path &&
27 git config core.hooksPath "$PWD/.git/custom-hooks/" &&
28 test_commit have_custom_hook_abs_path_trailing_slash &&
29 cat >expect <<-\EOF &&
36 test_cmp expect actual
39 test_expect_success
'git rev-parse --git-path hooks' '
40 git config core.hooksPath .git/custom-hooks &&
41 git rev-parse --git-path hooks/abc >actual &&
42 test .git/custom-hooks/abc = "$(cat actual)"
45 test_expect_success
'core.hooksPath=/dev/null' '
46 git clone -c core.hooksPath=/dev/null . no-templates &&
47 value="$(git -C no-templates config --local core.hooksPath)" &&
48 # The Bash used by Git for Windows rewrites `/dev/null` to `nul`
49 { test /dev/null = "$value" || test nul = "$value"; }