Imported Upstream version 2.5.0
[scm/test.git] / t / t-install-custom-hooks-path.sh
1 #!/usr/bin/env bash
2
3 . "$(dirname "$0")/testlib.sh"
4
5 # These tests rely on behavior found in 2.9.0 to perform themselves,
6 # specifically:
7 #   - core.hooksPath support
8 ensure_git_version_isnt $VERSION_LOWER "2.9.0"
9
10 begin_test "install with supported core.hooksPath"
11 (
12   set -e
13
14   repo_name="supported-custom-hooks-path"
15   git init "$repo_name"
16   cd "$repo_name"
17
18   hooks_dir="custom_hooks_dir"
19   mkdir -p "$hooks_dir"
20
21   git config --local core.hooksPath "$hooks_dir"
22
23   git lfs install 2>&1 | tee install.log
24   grep "Updated git hooks" install.log
25
26   [ -e "$hooks_dir/pre-push" ]
27   [ ! -e ".git/pre-push" ]
28   [ -e "$hooks_dir/post-checkout" ]
29   [ ! -e ".git/post-checkout" ]
30   [ -e "$hooks_dir/post-commit" ]
31   [ ! -e ".git/post-commit" ]
32   [ -e "$hooks_dir/post-merge" ]
33   [ ! -e ".git/post-merge" ]
34 )
35 end_test