read_packed_refs(): only check for a header at the top of the file
[git.git] / t / t1350-config-hooks-path.sh
blobf1f9aee9f5dcbcd2e722298736f990dfcf114f23
1 #!/bin/sh
3 test_description='Test the core.hooksPath configuration variable'
5 . ./test-lib.sh
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 &&
10 echo CUSTOM >>actual
11 EOF
12 write_script .git/hooks/pre-commit <<-\EOF
13 echo NORMAL >>actual
14 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 &&
28 NORMAL
29 CUSTOM
30 CUSTOM
31 CUSTOM
32 CUSTOM
33 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)"
43 test_done