diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-03-17 10:13:16 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-17 21:42:14 (GMT) |
commit | 66865d12a0a15276fd525a461e0873bf82d4f246 (patch) | |
tree | eb67caff7a3c52a90028da006282c0fc660b3b84 /t/t7520-ignored-hook-warning.sh | |
parent | c36c62859ae59e5ff3cd2a620ab8c906793dc615 (diff) | |
download | git-66865d12a0a15276fd525a461e0873bf82d4f246.zip git-66865d12a0a15276fd525a461e0873bf82d4f246.tar.gz git-66865d12a0a15276fd525a461e0873bf82d4f246.tar.bz2 |
tests: extend "test_hook" for "rm" and "chmod -x", convert "$HOOK"
Extend the "test_hook" function to take options to disable and remove
hooks. Using the wrapper instead of getting the path and running
"chmod -x" or "rm" will make it easier to eventually emulate the same
behavior with config-based hooks.
Not all of these tests need that new mode, but since the rest are
either closely related or use the same "$HOOK" pattern let's convert
them too.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7520-ignored-hook-warning.sh')
-rwxr-xr-x | t/t7520-ignored-hook-warning.sh | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/t/t7520-ignored-hook-warning.sh b/t/t7520-ignored-hook-warning.sh index 634fb7f..dc57526 100755 --- a/t/t7520-ignored-hook-warning.sh +++ b/t/t7520-ignored-hook-warning.sh @@ -5,10 +5,7 @@ test_description='ignored hook warning' . ./test-lib.sh test_expect_success setup ' - hookdir="$(git rev-parse --git-dir)/hooks" && - hook="$hookdir/pre-commit" && - mkdir -p "$hookdir" && - write_script "$hook" <<-\EOF + test_hook --setup pre-commit <<-\EOF exit 0 EOF ' @@ -19,20 +16,20 @@ test_expect_success 'no warning if hook is not ignored' ' ' test_expect_success POSIXPERM 'warning if hook is ignored' ' - chmod -x "$hook" && + test_hook --disable pre-commit && 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 && - chmod -x "$hook" && + test_hook --disable pre-commit && 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' ' - rm -f "$hook" && + test_hook --remove pre-commit && test_unconfig advice.ignoredHook && git commit --allow-empty -m "even more" 2>message && test_i18ngrep ! -e "hook was ignored" message |