aboutsummaryrefslogtreecommitdiffstats
path: root/t/t1800-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t1800-hook.sh')
-rwxr-xr-xt/t1800-hook.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 3506f627b6..0f0c706d07 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -195,4 +195,19 @@ test_expect_success 'stdin to hooks' '
test_cmp expect actual
'
+test_expect_success 'clone protections' '
+ test_config core.hooksPath "$(pwd)/my-hooks" &&
+ mkdir -p my-hooks &&
+ write_script my-hooks/test-hook <<-\EOF &&
+ echo Hook ran $1
+ EOF
+
+ git hook run test-hook 2>err &&
+ grep "Hook ran" err &&
+ test_must_fail env GIT_CLONE_PROTECTION_ACTIVE=true \
+ git hook run test-hook 2>err &&
+ grep "active .core.hooksPath" err &&
+ ! grep "Hook ran" err
+'
+
test_done