2017-10-06 08:07:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='ignored hook warning'
|
|
|
|
|
2022-11-08 18:17:39 +00:00
|
|
|
TEST_PASSES_SANITIZE_LEAK=true
|
2017-10-06 08:07:55 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
2022-03-17 10:13:16 +00:00
|
|
|
test_hook --setup pre-commit <<-\EOF
|
2017-10-06 08:07:55 +00:00
|
|
|
exit 0
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'no warning if hook is not ignored' '
|
|
|
|
git commit --allow-empty -m "more" 2>message &&
|
|
|
|
test_i18ngrep ! -e "hook was ignored" message
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success POSIXPERM 'warning if hook is ignored' '
|
2022-03-17 10:13:16 +00:00
|
|
|
test_hook --disable pre-commit &&
|
2017-10-06 08:07:55 +00:00
|
|
|
git commit --allow-empty -m "even more" 2>message &&
|
|
|
|
test_i18ngrep -e "hook was ignored" message
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success POSIXPERM 'no warning if advice.ignoredHook set to false' '
|
|
|
|
test_config advice.ignoredHook false &&
|
2022-03-17 10:13:16 +00:00
|
|
|
test_hook --disable pre-commit &&
|
2017-10-06 08:07:55 +00:00
|
|
|
git commit --allow-empty -m "even more" 2>message &&
|
|
|
|
test_i18ngrep ! -e "hook was ignored" message
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'no warning if unset advice.ignoredHook and hook removed' '
|
2022-03-17 10:13:16 +00:00
|
|
|
test_hook --remove pre-commit &&
|
2017-10-06 08:07:55 +00:00
|
|
|
test_unconfig advice.ignoredHook &&
|
|
|
|
git commit --allow-empty -m "even more" 2>message &&
|
|
|
|
test_i18ngrep ! -e "hook was ignored" message
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|