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>
Adrian Ratiu committed
Apr 8, 2026 at 19:11 UTC
373d43e0829d91c61f35f46f6715a23adda7b35d
1 file changed
+6
-6
t/t1800-hook.sh
+6
-6
@@ -6,16 +6,16 @@ test_description='git-hook command and config-managed multihooks'
6
. "$TEST_DIRECTORY"/lib-terminal.sh
7
8
setup_hooks () {
9
- test_config hook.ghi.command "/path/ghi"
10
- test_config hook.ghi.event pre-commit --add
11
- test_config hook.ghi.event test-hook --add
12
- test_config_global hook.def.command "/path/def"
9
+ test_config hook.ghi.command "/path/ghi" &&
10
+ test_config hook.ghi.event pre-commit --add &&
11
+ test_config hook.ghi.event test-hook --add &&
12
+ test_config_global hook.def.command "/path/def" &&
13
test_config_global hook.def.event pre-commit --add
14
}
15
16
setup_hookdir () {
17
- mkdir .git/hooks
18
- write_script .git/hooks/pre-commit <<-EOF
17
+ mkdir -p .git/hooks &&
18
+ write_script .git/hooks/pre-commit <<-EOF &&
19
echo \"Legacy Hook\"
20
EOF
21
test_when_finished rm -rf .git/hooks