Git development
 help / color / mirror / Atom feed
* [GSoC PATCH] t5402: use test_path_* helpers instead of test -e and test -f
@ 2026-10-29 20:00 Tilak Kumar
  2026-10-29 20:17 ` Mark C. Chu-Carroll
  0 siblings, 1 reply; 3+ messages in thread
From: Tilak Kumar @ 2026-10-29 20:00 UTC (permalink / raw)
  To: git; +Cc: Tilak Kumar

Use test_path_exists and test_path_is_missing instead of "test -e"
and "! test -f" in the post-merge hook tests, so that a failure
reports which path was unexpectedly missing or present instead of
failing silently.

Signed-off-by: Tilak Kumar <raaztilak07@gmail.com>
---
 t/t5402-post-merge-hook.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh
index c77aa56421..1e222ac28f 100755
--- a/t/t5402-post-merge-hook.sh
+++ b/t/t5402-post-merge-hook.sh
@@ -37,12 +37,12 @@ test_expect_success 'setup clone hooks' '
 
 test_expect_success 'post-merge does not run for up-to-date ' '
 	GIT_DIR=clone1/.git git merge $commit0 &&
-	! test -f clone1/.git/post-merge.args
+	test_path_is_missing clone1/.git/post-merge.args
 '
 
 test_expect_success 'post-merge runs as expected ' '
 	GIT_DIR=clone1/.git git merge $commit1 &&
-	test -e clone1/.git/post-merge.args
+	test_path_exists clone1/.git/post-merge.args
 '
 
 test_expect_success 'post-merge from normal merge receives the right argument ' '
@@ -51,7 +51,7 @@ test_expect_success 'post-merge from normal merge receives the right argument '
 
 test_expect_success 'post-merge from squash merge runs as expected ' '
 	GIT_DIR=clone2/.git git merge --squash $commit1 &&
-	test -e clone2/.git/post-merge.args
+	test_path_exists clone2/.git/post-merge.args
 '
 
 test_expect_success 'post-merge from squash merge receives the right argument ' '
-- 
2.55.0


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

* Re: [GSoC PATCH] t5402: use test_path_* helpers instead of test -e and test -f
  2026-10-29 20:00 [GSoC PATCH] t5402: use test_path_* helpers instead of test -e and test -f Tilak Kumar
@ 2026-10-29 20:17 ` Mark C. Chu-Carroll
  2026-10-29 20:32   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Mark C. Chu-Carroll @ 2026-10-29 20:17 UTC (permalink / raw)
  To: Tilak Kumar, git

On Thu Oct 29, 2026 at 4:00 PM EDT, Tilak Kumar wrote:
> Use test_path_exists and test_path_is_missing instead of "test -e"
> and "! test -f" in the post-merge hook tests, so that a failure
> reports which path was unexpectedly missing or present instead of
> failing silently.
>
> Signed-off-by: Tilak Kumar <raaztilak07@gmail.com>
> ---
>  t/t5402-post-merge-hook.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh
> index c77aa56421..1e222ac28f 100755
> --- a/t/t5402-post-merge-hook.sh
> +++ b/t/t5402-post-merge-hook.sh
> @@ -37,12 +37,12 @@ test_expect_success 'setup clone hooks' '
>  
>  test_expect_success 'post-merge does not run for up-to-date ' '
>  	GIT_DIR=clone1/.git git merge $commit0 &&
> -	! test -f clone1/.git/post-merge.args
> +	test_path_is_missing clone1/.git/post-merge.args
>  '
>  
>  test_expect_success 'post-merge runs as expected ' '
>  	GIT_DIR=clone1/.git git merge $commit1 &&
> -	test -e clone1/.git/post-merge.args
> +	test_path_exists clone1/.git/post-merge.args
>  '
>  
>  test_expect_success 'post-merge from normal merge receives the right argument ' '
> @@ -51,7 +51,7 @@ test_expect_success 'post-merge from normal merge receives the right argument '
>  
>  test_expect_success 'post-merge from squash merge runs as expected ' '
>  	GIT_DIR=clone2/.git git merge --squash $commit1 &&
> -	test -e clone2/.git/post-merge.args
> +	test_path_exists clone2/.git/post-merge.args
>  '
>  
>  test_expect_success 'post-merge from squash merge receives the right argument ' '

looks correct to me.



-- 
Mark Craig Chu-Carroll (@MarkChuCarroll at gitlab)
*** Software Tools/Math Geek - Software Engineer at Gitlab
*** Work Email: mcarroll@gitlab.com / markchucarroll@fastmail.com
*** Personal Blog: http://goodmath.org/blog / Personal email: markcc@gmail.com


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

* Re: [GSoC PATCH] t5402: use test_path_* helpers instead of test -e and test -f
  2026-10-29 20:17 ` Mark C. Chu-Carroll
@ 2026-10-29 20:32   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2026-10-29 20:32 UTC (permalink / raw)
  To: Mark C. Chu-Carroll; +Cc: Tilak Kumar, git

"Mark C. Chu-Carroll" <markchucarroll@fastmail.com> writes:

> On Thu Oct 29, 2026 at 4:00 PM EDT, Tilak Kumar wrote:
>> Use test_path_exists and test_path_is_missing instead of "test -e"
>> and "! test -f" in the post-merge hook tests, so that a failure
>> reports which path was unexpectedly missing or present instead of
>> failing silently.
>>
>> Signed-off-by: Tilak Kumar <raaztilak07@gmail.com>
>> ...
>>  
>>  test_expect_success 'post-merge from squash merge runs as expected ' '
>>  	GIT_DIR=clone2/.git git merge --squash $commit1 &&
>> -	test -e clone2/.git/post-merge.args
>> +	test_path_exists clone2/.git/post-merge.args
>>  '
>>  
>>  test_expect_success 'post-merge from squash merge receives the right argument ' '
>
> looks correct to me.

Thanks for writing and reviewing.  Queued.

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

end of thread, other threads:[~2026-10-29 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 20:00 [GSoC PATCH] t5402: use test_path_* helpers instead of test -e and test -f Tilak Kumar
2026-10-29 20:17 ` Mark C. Chu-Carroll
2026-10-29 20:32   ` 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