2017-10-06 10:07:55 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
test_description='ignored hook warning'
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
2022-03-17 11:13:16 +01:00
|
|
|
test_hook --setup pre-commit <<-\EOF
|
2017-10-06 10:07:55 +02: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 11:13:16 +01:00
|
|
|
test_hook --disable pre-commit &&
|
2017-10-06 10:07:55 +02: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 11:13:16 +01:00
|
|
|
test_hook --disable pre-commit &&
|
2017-10-06 10:07:55 +02: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 11:13:16 +01:00
|
|
|
test_hook --remove pre-commit &&
|
2017-10-06 10:07:55 +02:00
|
|
|
test_unconfig advice.ignoredHook &&
|
|
|
|
git commit --allow-empty -m "even more" 2>message &&
|
|
|
|
test_i18ngrep ! -e "hook was ignored" message
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|