t1800: add &&-chains to test helper functions

Add the missing &&'s so we properly propagate failures
between commands in the hook helper functions.

Also add a missing mkdir -p arg (found by adding the &&).

Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Adrian Ratiu
2026-04-08 19:11:48 +03:00
committed by Junio C Hamano
parent 2b39a27d40
commit 373d43e082

View File

@@ -6,16 +6,16 @@ test_description='git-hook command and config-managed multihooks'
. "$TEST_DIRECTORY"/lib-terminal.sh
setup_hooks () {
test_config hook.ghi.command "/path/ghi"
test_config hook.ghi.event pre-commit --add
test_config hook.ghi.event test-hook --add
test_config_global hook.def.command "/path/def"
test_config hook.ghi.command "/path/ghi" &&
test_config hook.ghi.event pre-commit --add &&
test_config hook.ghi.event test-hook --add &&
test_config_global hook.def.command "/path/def" &&
test_config_global hook.def.event pre-commit --add
}
setup_hookdir () {
mkdir .git/hooks
write_script .git/hooks/pre-commit <<-EOF
mkdir -p .git/hooks &&
write_script .git/hooks/pre-commit <<-EOF &&
echo \"Legacy Hook\"
EOF
test_when_finished rm -rf .git/hooks