Git development
 help / color / mirror / Atom feed
* [PATCH] t1800: add &&-chains to test helper functions
@ 2026-04-08 16:11 Adrian Ratiu
  2026-04-08 17:16 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Ratiu @ 2026-04-08 16:11 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Adrian Ratiu, SZEDER Gábor

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>
---
This is a small fix reported by Szeder, based on the master branch
GitHub branch: https://github.com/10ne1/git/tree/refs/heads/dev/aratiu/tests-add-missing-and-chains
Clean CI run: https://github.com/10ne1/git/actions/runs/24137982261
---
 t/t1800-hook.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
index 96749fc06d..33decc66c0 100755
--- a/t/t1800-hook.sh
+++ b/t/t1800-hook.sh
@@ -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
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] t1800: add &&-chains to test helper functions
  2026-04-08 16:11 [PATCH] t1800: add &&-chains to test helper functions Adrian Ratiu
@ 2026-04-08 17:16 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-04-08 17:16 UTC (permalink / raw)
  To: Adrian Ratiu; +Cc: git, SZEDER Gábor

Adrian Ratiu <adrian.ratiu@collabora.com> writes:

> 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>
> ---
> This is a small fix reported by Szeder, based on the master branch

Thanks, both of you.  Will directly apply on 'master'.

> GitHub branch: https://github.com/10ne1/git/tree/refs/heads/dev/aratiu/tests-add-missing-and-chains
> Clean CI run: https://github.com/10ne1/git/actions/runs/24137982261

> ---
>  t/t1800-hook.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/t/t1800-hook.sh b/t/t1800-hook.sh
> index 96749fc06d..33decc66c0 100755
> --- a/t/t1800-hook.sh
> +++ b/t/t1800-hook.sh
> @@ -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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-08 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08 16:11 [PATCH] t1800: add &&-chains to test helper functions Adrian Ratiu
2026-04-08 17:16 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox