Subject: Re: [PATCH] [GSoC] t5403: use test_path_is_file instead of test -f

From: Junio C Hamano <[email-masked]>
Date: Thu, 01 Jan 2026 09:27:45 +0900

Deveshi Dwivedi <[email-masked]> writes:

> Replace 'test -f' with the test_path_is_file in
> t5403-post-checkout-hook.sh. This helper provides better error
> messages when tests fail, making it easier to debug issues.

All true, so I'll queue the patch.  Thanks.

A #leftoverbit is to think about what this test checks, if it
makes sense, and if we can do better.  The expected outcome of this
clone is stable, so the input fed to the hook should also be stable.
With the same brain-cycle to write a test that checks the existence
of the output file (i.e., proving that the hook was run), we should
be able to concoct a test that validates the contents of the output.

> Signed-off-by: Deveshi Dwivedi <[email-masked]>
> ---
>  t/t5403-post-checkout-hook.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
> index 978f240cda..1462e3365b 100755
> --- a/t/t5403-post-checkout-hook.sh
> +++ b/t/t5403-post-checkout-hook.sh
> @@ -109,7 +109,7 @@ test_expect_success 'post-checkout hook is triggered by clone' '
>  	echo "$@" >"$GIT_DIR/post-checkout.args"
>  	EOF
>  	git clone --template=templates . clone3 &&
> -	test -f clone3/.git/post-checkout.args
> +	test_path_is_file clone3/.git/post-checkout.args
>  '
>  
>  test_done