Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1350-config-hooks-path.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1350-config-hooks-path.sh` 51 lines ยท 1456 bytes Raw Blame History 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 >actual && 9 mkdir -p .git/custom-hooks && 10 write_script .git/custom-hooks/pre-commit <<-\EOF && 11 echo CUSTOM >>actual 12 EOF 13 test_hook --setup pre-commit <<-\EOF 14 echo NORMAL >>actual 15 EOF 16 ' 17 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 && 29 NORMAL 30 CUSTOM 31 CUSTOM 32 CUSTOM 33 CUSTOM 34 EOF 35 test_cmp expect actual 36 ' 37 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)" 42 ' 43 44 test_expect_success 'core.hooksPath=/dev/null' ' 45 git clone -c core.hooksPath=/dev/null . no-templates && 46 value="$(git -C no-templates config --local core.hooksPath)" && 47 # The Bash used by Git for Windows rewrites `/dev/null` to `nul` 48 { test /dev/null = "$value" || test nul = "$value"; } 49 ' 50 51 test_done