]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1800: add &&-chains to test helper functions
authorAdrian Ratiu <adrian.ratiu@collabora.com>
Wed, 8 Apr 2026 16:11:48 +0000 (19:11 +0300)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2026 17:15:47 +0000 (10:15 -0700)
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>
t/t1800-hook.sh

index 96749fc06d722396d43b0e5d358415ff7844315c..33decc66c0ea8d05957708fb05cef74f6cf3148e 100755 (executable)
@@ -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