Git development
 help / color / mirror / Atom feed
* [PATCH] t5301: use test_path_is_file instead of test -f
@ 2026-10-20  9:26 Roger Koranteng via GitGitGadget
  2026-10-21 16:00 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Koranteng via GitGitGadget @ 2026-10-20  9:26 UTC (permalink / raw)
  To: git
  Cc: Kaartic Sivaraam, Christian Couder, Siddharth Asthana,
	Usman Akinyemi, Roger Koranteng, Roger Koranteng

From: Roger Koranteng <rogerkorantenng@gmail.com>

Replace raw 'test -f' assertions with the 'test_path_is_file' helper,
which gives diagnostic output when the assertion fails.

Signed-off-by: Roger Koranteng <rogerkorantenng@gmail.com>
---
    t5301: use test_path_is_file instead of test -f

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2269%2Frogerkorantenng%2Ft5301-modernize-path-checks-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2269/rogerkorantenng/t5301-modernize-path-checks-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2269

 t/t5301-sliding-window.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
index 3c3666b278..b6868229bf 100755
--- a/t/t5301-sliding-window.sh
+++ b/t/t5301-sliding-window.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup' '
 	git repack -a -d &&
 	test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
 	pack1=$(ls .git/objects/pack/*.pack) &&
-	test -f "$pack1"
+	test_path_is_file "$pack1"
 '
 
 test_expect_success 'verify-pack -v, defaults' '
@@ -48,7 +48,7 @@ test_expect_success 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' '
 	git repack -a -d &&
 	test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
 	pack2=$(ls .git/objects/pack/*.pack) &&
-	test -f "$pack2" &&
+	test_path_is_file "$pack2" &&
 	test "$pack1" \!= "$pack2"
 '
 

base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb
-- 
gitgitgadget

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

* Re: [PATCH] t5301: use test_path_is_file instead of test -f
  2026-10-20  9:26 [PATCH] t5301: use test_path_is_file instead of test -f Roger Koranteng via GitGitGadget
@ 2026-10-21 16:00 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-10-21 16:00 UTC (permalink / raw)
  To: Roger Koranteng via GitGitGadget
  Cc: git, Kaartic Sivaraam, Christian Couder, Siddharth Asthana,
	Usman Akinyemi, Roger Koranteng

"Roger Koranteng via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Roger Koranteng <rogerkorantenng@gmail.com>
>
> Replace raw 'test -f' assertions with the 'test_path_is_file' helper,
> which gives diagnostic output when the assertion fails.
>
> Signed-off-by: Roger Koranteng <rogerkorantenng@gmail.com>
> ---
>     t5301: use test_path_is_file instead of test -f
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2269%2Frogerkorantenng%2Ft5301-modernize-path-checks-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2269/rogerkorantenng/t5301-modernize-path-checks-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/2269
>
>  t/t5301-sliding-window.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh
> index 3c3666b278..b6868229bf 100755
> --- a/t/t5301-sliding-window.sh
> +++ b/t/t5301-sliding-window.sh
> @@ -22,7 +22,7 @@ test_expect_success 'setup' '
>  	git repack -a -d &&
>  	test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
>  	pack1=$(ls .git/objects/pack/*.pack) &&
> -	test -f "$pack1"
> +	test_path_is_file "$pack1"
>  '

OK.

>  test_expect_success 'verify-pack -v, defaults' '
> @@ -48,7 +48,7 @@ test_expect_success 'repack -a -d, packedGit{WindowSize,Limit} == 1 page' '
>  	git repack -a -d &&
>  	test "$(git count-objects)" = "0 objects, 0 kilobytes" &&
>  	pack2=$(ls .git/objects/pack/*.pack) &&
> -	test -f "$pack2" &&
> +	test_path_is_file "$pack2" &&

OK.

>  	test "$pack1" \!= "$pack2"
>  '

This is an existing wart but we shouldn't quote letters that we do
not have to quote like this.  It gives a wrong hint to readers that
something fishy might be going on and distracts them.  We may want
to have a separate job to find warts in tests similar to this one
and eradicate them all, but that is totally outside the scope of
this patch.

Looking good to me.



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

end of thread, other threads:[~2026-10-21 16:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20  9:26 [PATCH] t5301: use test_path_is_file instead of test -f Roger Koranteng via GitGitGadget
2026-10-21 16:00 ` 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