]>
Commit | Line | Data |
---|---|---|
867ad08a ÆAB |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test the core.hooksPath configuration variable' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
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 | |
15 | ' | |
16 | ||
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 | |
35 | ' | |
36 | ||
9445b492 JS |
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)" | |
41 | ' | |
42 | ||
867ad08a | 43 | test_done |