submodule--helper: advise on fatal alternate error
[git.git] / t / t7520-ignored-hook-warning.sh
blob634fb7f23a040be8e6afbf7e3946048f7b3dc163
1 #!/bin/sh
3 test_description='ignored hook warning'
5 . ./test-lib.sh
7 test_expect_success setup '
8 hookdir="$(git rev-parse --git-dir)/hooks" &&
9 hook="$hookdir/pre-commit" &&
10 mkdir -p "$hookdir" &&
11 write_script "$hook" <<-\EOF
12 exit 0
13 EOF
16 test_expect_success 'no warning if hook is not ignored' '
17 git commit --allow-empty -m "more" 2>message &&
18 test_i18ngrep ! -e "hook was ignored" message
21 test_expect_success POSIXPERM 'warning if hook is ignored' '
22 chmod -x "$hook" &&
23 git commit --allow-empty -m "even more" 2>message &&
24 test_i18ngrep -e "hook was ignored" message
27 test_expect_success POSIXPERM 'no warning if advice.ignoredHook set to false' '
28 test_config advice.ignoredHook false &&
29 chmod -x "$hook" &&
30 git commit --allow-empty -m "even more" 2>message &&
31 test_i18ngrep ! -e "hook was ignored" message
34 test_expect_success 'no warning if unset advice.ignoredHook and hook removed' '
35 rm -f "$hook" &&
36 test_unconfig advice.ignoredHook &&
37 git commit --allow-empty -m "even more" 2>message &&
38 test_i18ngrep ! -e "hook was ignored" message
41 test_done