]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7520-ignored-hook-warning.sh
l10n: fr v2.23.0 round 2
[thirdparty/git.git] / t / t7520-ignored-hook-warning.sh
1 #!/bin/sh
2
3 test_description='ignored hook warning'
4
5 . ./test-lib.sh
6
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
14 '
15
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
19 '
20
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
25 '
26
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
32 '
33
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
39 '
40
41 test_done