git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GSoC] [PATCH] t1011: replace test -f with test_path_is_file
@ 2022-04-09 11:44 Siddharth Asthana
  2022-04-11 19:09 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Siddharth Asthana @ 2022-04-09 11:44 UTC (permalink / raw)
  To: git
  Cc: Siddharth Asthana, Ævar Arnfjörð Bjarmason,
	Junio C Hamano, Derrick Stolee, Elijah Newren, Lars Schneider

Use test_path_is_file() instead of 'test -f' for better debugging
information.
---
 t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index dd957be1b7..c0b97a622e 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '
@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-
 	read_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
 	S subsub/added
 	EOF
 	test_cmp expected.swt result &&
-	! test -f init.t &&
-	! test -f sub/added
+	! test_path_is_file init.t &&
+	! test_path_is_file sub/added
 '
 
 test_expect_success 'match directories with trailing slash' '
@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t > result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	! test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories without trailing slash' '
@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	! test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories with negated patterns' '
@@ -129,9 +129,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation result &&
-	test ! -f init.t &&
-	test ! -f sub/added &&
-	test -f sub/addedtoo
+	! test_path_is_file init.t &&
+	! test_path_is_file sub/added &&
+	test_path_is_file sub/addedtoo
 '
 
 test_expect_success 'match directories with negated patterns (2)' '
@@ -150,9 +150,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation2 result &&
-	test -f init.t &&
-	test -f sub/added &&
-	test ! -f sub/addedtoo
+	test_path_is_file init.t &&
+	test_path_is_file sub/added &&
+	! test_path_is_file sub/addedtoo
 '
 
 test_expect_success 'match directory pattern' '
@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	! test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'checkout area changes' '
@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-nosub result &&
-	test -f init.t &&
-	test ! -f sub/added
+	test_path_is_file init.t &&
+	! test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree updates worktree, absent case' '
 	echo sub/added >.git/info/sparse-checkout &&
 	git checkout -f top &&
 	read_tree_u_must_succeed -m -u HEAD^ &&
-	test ! -f init.t
+	! test_path_is_file init.t
 '
 
 test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '
@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout -f removed &&
 	read_tree_u_must_succeed -u -m HEAD^ &&
-	test ! -f sub/added
+	! test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree adds to worktree, dirty case' '
@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout removed &&
 	git ls-files sub/added >result &&
-	test ! -f sub/added &&
+	! test_path_is_file sub/added &&
 	test_must_be_empty result
 '
 
-- 
2.35.1


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

* Re: [GSoC] [PATCH] t1011: replace test -f with test_path_is_file
  2022-04-09 11:44 [GSoC] [PATCH] t1011: replace test -f with test_path_is_file Siddharth Asthana
@ 2022-04-11 19:09 ` Junio C Hamano
  2022-04-12 20:21   ` Siddharth Asthana
  2022-04-12 20:37   ` [GSoC] [PATCH v2] " Siddharth Asthana
  0 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2022-04-11 19:09 UTC (permalink / raw)
  To: Siddharth Asthana
  Cc: git, Ævar Arnfjörð Bjarmason, Derrick Stolee,
	Elijah Newren, Lars Schneider

Siddharth Asthana <siddharthasthana31@gmail.com> writes:

> Use test_path_is_file() instead of 'test -f' for better debugging
> information.
> ---

missing Sign-off.

>  	test_cmp expected.swt result &&
> -	! test -f init.t &&
> -	! test -f sub/added
> +	! test_path_is_file init.t &&
> +	! test_path_is_file sub/added
>  '

Given the definition of the helper function, i.e.

        test_path_is_file () {
                test "$#" -ne 1 && BUG "1 param"
                if ! test -f "$1"
                then
                        echo "File $1 doesn't exist"
                        false
                fi
        }

the new test will _complain_ "init.t doesn't exist" when we have
successfully run the test, while it will be _silent_ when init.t
that _should_ not exist is there.

Which is the complete opposite of the spirit of why we want to use
the helper when we expect the path "$1" to exist, i.e. loudly fail
when our expectation is _not_ met.

$ git grep '! test_path_is' t/

shows that we already have such a misuse of test_path_is_dir in one
place, but luckily we do not have any for test_path_is_file or other
similar helpers.  test_path_is_hidden is sort-of OK as that is not
about verbosity.

In these two test, we do not expect init.t or sub/added to _exist_
at all.  It's not like we are happy if we see init.d exist as a
directory (which is not a file).  test_path_is_missing is probably
the right helper to use.

It is not very plausible that we'd want to assert that existence of
a path as a file the only bad condition (i.e. we are happy if the
path did not exist or it is a directory, symlink, or a socket), so I
think the simple 

	Never use '! test_path_is_file'; test_path_is_missing may be
	what you are looking for.

is a good enough rule.

If not, we could allow the caller to write such a convoluted "only
existence of a path as a file is unacceptable and everything else is
good" assertion as

    test_path_is_file ! init.d

with something like

        test_path_is_file () {
		expecting_file=true
		if test "$1" = "!"
		then
			expecting_file=false
			shift
		fi
                test "$#" -ne 1 && BUG "1 param"
                if test -f "$1"
                then
                	$expecting_file || echo "File $1 exists"
                        $expecting_file
		else
			$expecting_file && echo "File $1 doesn't exist"
                        ! $expecting_file
                fi
        }

but I do not think we want to go that way.

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

* Re: [GSoC] [PATCH] t1011: replace test -f with test_path_is_file
  2022-04-11 19:09 ` Junio C Hamano
@ 2022-04-12 20:21   ` Siddharth Asthana
  2022-04-12 20:37   ` [GSoC] [PATCH v2] " Siddharth Asthana
  1 sibling, 0 replies; 8+ messages in thread
From: Siddharth Asthana @ 2022-04-12 20:21 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Ævar Arnfjörð Bjarmason, Derrick Stolee,
	Elijah Newren, Lars Schneider

Thanks a lot Junio for the feedback. I will send a new patch fixing it.

Best Wishes
Siddharth

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

* [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file
  2022-04-11 19:09 ` Junio C Hamano
  2022-04-12 20:21   ` Siddharth Asthana
@ 2022-04-12 20:37   ` Siddharth Asthana
  2022-04-14  8:19     ` Christian Couder
  1 sibling, 1 reply; 8+ messages in thread
From: Siddharth Asthana @ 2022-04-12 20:37 UTC (permalink / raw)
  To: gitster
  Cc: avarab, derrickstolee, git, larsxschneider, newren,
	siddharthasthana31

Use test_path_is_file() instead of 'test -f' for better debugging
information.

Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
---
 t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index dd957be1b7..63a553d7b3 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '
@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-
 	read_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
 	S subsub/added
 	EOF
 	test_cmp expected.swt result &&
-	! test -f init.t &&
-	! test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'match directories with trailing slash' '
@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t > result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories without trailing slash' '
@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories with negated patterns' '
@@ -129,9 +129,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation result &&
-	test ! -f init.t &&
-	test ! -f sub/added &&
-	test -f sub/addedtoo
+	test_path_is_missing init.t &&
+	test_path_is_missing sub/added &&
+	test_path_is_file sub/addedtoo
 '
 
 test_expect_success 'match directories with negated patterns (2)' '
@@ -150,9 +150,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation2 result &&
-	test -f init.t &&
-	test -f sub/added &&
-	test ! -f sub/addedtoo
+	test_path_is_file init.t &&
+	test_path_is_file sub/added &&
+	test_path_is_missing sub/addedtoo
 '
 
 test_expect_success 'match directory pattern' '
@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'checkout area changes' '
@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-nosub result &&
-	test -f init.t &&
-	test ! -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'read-tree updates worktree, absent case' '
 	echo sub/added >.git/info/sparse-checkout &&
 	git checkout -f top &&
 	read_tree_u_must_succeed -m -u HEAD^ &&
-	test ! -f init.t
+	test_path_is_missing init.t
 '
 
 test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '
@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout -f removed &&
 	read_tree_u_must_succeed -u -m HEAD^ &&
-	test ! -f sub/added
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'read-tree adds to worktree, dirty case' '
@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout removed &&
 	git ls-files sub/added >result &&
-	test ! -f sub/added &&
+	test_path_is_missing sub/added &&
 	test_must_be_empty result
 '
 
-- 
2.35.2


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

* Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file
  2022-04-12 20:37   ` [GSoC] [PATCH v2] " Siddharth Asthana
@ 2022-04-14  8:19     ` Christian Couder
  2022-04-14 16:42       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Couder @ 2022-04-14  8:19 UTC (permalink / raw)
  To: Siddharth Asthana
  Cc: Junio C Hamano, Ævar Arnfjörð Bjarmason,
	Derrick Stolee, git, Lars Schneider, Elijah Newren

On Wed, Apr 13, 2022 at 2:06 AM Siddharth Asthana
<siddharthasthana31@gmail.com> wrote:
>
> Use test_path_is_file() instead of 'test -f' for better debugging
> information.

Actually it looks like you are also using test_path_is_missing() now,
so you might want to update the commit message, and maybe also the
commit subject.

In the commit message it might be nice if there were some explanations
about why `test_path_is_missing PATH` should be used instead of `!
test_path_is_file PATH` or `test ! -f PATH` or `! test -f PATH`.

The diff part of the patch looks good to me. Thanks!

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

* Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file
  2022-04-14  8:19     ` Christian Couder
@ 2022-04-14 16:42       ` Junio C Hamano
  2022-04-16 13:55         ` Siddharth Asthana
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2022-04-14 16:42 UTC (permalink / raw)
  To: Christian Couder
  Cc: Siddharth Asthana, Ævar Arnfjörð Bjarmason,
	Derrick Stolee, git, Lars Schneider, Elijah Newren

Christian Couder <christian.couder@gmail.com> writes:

> In the commit message it might be nice if there were some explanations
> about why `test_path_is_missing PATH` should be used instead of `!
> test_path_is_file PATH` or `test ! -f PATH` or `! test -f PATH`.

Meaning "the original used '! test -f foo' but what it meant was
that it did not want to see 'foo' on the filesystem, regardless of
its type, so it should have been '!test -e foo' to begin with"?

I guess it does not hurt, as the original would have passed by
mistake if these paths were on the filesystem as directories, but
the new code would behave differently, and even if it is a "bugfix",
it still is a behaviour change that may be worth explaining.

> The diff part of the patch looks good to me. Thanks!

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

* Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file
  2022-04-14 16:42       ` Junio C Hamano
@ 2022-04-16 13:55         ` Siddharth Asthana
  2022-04-16 13:59           ` [PATCH v3] t1011: replace test -f with test_path_is* helpers Siddharth Asthana
  0 siblings, 1 reply; 8+ messages in thread
From: Siddharth Asthana @ 2022-04-16 13:55 UTC (permalink / raw)
  To: Junio C Hamano, Christian Couder
  Cc: Ævar Arnfjörð Bjarmason, Derrick Stolee, git,
	Lars Schneider, Elijah Newren, Christian Couder

Thanks a lot Christian and Junio for the review. I will send a patch to 
update the commit message.

Best Wishes
Siddharth

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

* [PATCH v3] t1011: replace test -f with test_path_is* helpers
  2022-04-16 13:55         ` Siddharth Asthana
@ 2022-04-16 13:59           ` Siddharth Asthana
  0 siblings, 0 replies; 8+ messages in thread
From: Siddharth Asthana @ 2022-04-16 13:59 UTC (permalink / raw)
  To: siddharthasthana31
  Cc: avarab, christian.couder, derrickstolee, git, gitster,
	larsxschneider, newren

Replace 'test -f' with test_path_is_file for better debugging
information.

Replace '! test -f' with 'test_path_is_missing' helper instead of
'! test_path_is_file'. It is because, in the test, when we write

   ! test -f init.t &&
   ! test -f sub/added

we do not expect init.t or sub/added to exist at all. But when we write

   ! test_path_is_file init.t &&
   ! test_path_is_file sub/added

the test will _complain_ "init.t doesn't exist" when the test runs
successully, while it will be _silent_ when init.t that should not exist
is there. This is complete opposite of what we want to do in the test.
We want to fail loudly when our expectation is not met.

So, replace '! test -f' with 'test_path_is_missing', as we do not expect
foo to exist, rgardless of its type, i.e our expectation is met
if the path did not exist or it is a directory, symlink or a socket.

Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
---
 t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh
index dd957be1b7..63a553d7b3 100755
--- a/t/t1011-read-tree-sparse-checkout.sh
+++ b/t/t1011-read-tree-sparse-checkout.sh
@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '
@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-
 	read_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt result &&
-	test -f init.t &&
-	test -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '
 	S subsub/added
 	EOF
 	test_cmp expected.swt result &&
-	! test -f init.t &&
-	! test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'match directories with trailing slash' '
@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t > result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories without trailing slash' '
@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'match directories with negated patterns' '
@@ -129,9 +129,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation result &&
-	test ! -f init.t &&
-	test ! -f sub/added &&
-	test -f sub/addedtoo
+	test_path_is_missing init.t &&
+	test_path_is_missing sub/added &&
+	test_path_is_file sub/addedtoo
 '
 
 test_expect_success 'match directories with negated patterns (2)' '
@@ -150,9 +150,9 @@ EOF
 	git read-tree -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-negation2 result &&
-	test -f init.t &&
-	test -f sub/added &&
-	test ! -f sub/addedtoo
+	test_path_is_file init.t &&
+	test_path_is_file sub/added &&
+	test_path_is_missing sub/addedtoo
 '
 
 test_expect_success 'match directory pattern' '
@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-noinit result &&
-	test ! -f init.t &&
-	test -f sub/added
+	test_path_is_missing init.t &&
+	test_path_is_file sub/added
 '
 
 test_expect_success 'checkout area changes' '
@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '
 	read_tree_u_must_succeed -m -u HEAD &&
 	git ls-files -t >result &&
 	test_cmp expected.swt-nosub result &&
-	test -f init.t &&
-	test ! -f sub/added
+	test_path_is_file init.t &&
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'read-tree updates worktree, absent case' '
 	echo sub/added >.git/info/sparse-checkout &&
 	git checkout -f top &&
 	read_tree_u_must_succeed -m -u HEAD^ &&
-	test ! -f init.t
+	test_path_is_missing init.t
 '
 
 test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '
@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout -f removed &&
 	read_tree_u_must_succeed -u -m HEAD^ &&
-	test ! -f sub/added
+	test_path_is_missing sub/added
 '
 
 test_expect_success 'read-tree adds to worktree, dirty case' '
@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '
 	echo init.t >.git/info/sparse-checkout &&
 	git checkout removed &&
 	git ls-files sub/added >result &&
-	test ! -f sub/added &&
+	test_path_is_missing sub/added &&
 	test_must_be_empty result
 '
 
-- 
2.35.3


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

end of thread, other threads:[~2022-04-16 13:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09 11:44 [GSoC] [PATCH] t1011: replace test -f with test_path_is_file Siddharth Asthana
2022-04-11 19:09 ` Junio C Hamano
2022-04-12 20:21   ` Siddharth Asthana
2022-04-12 20:37   ` [GSoC] [PATCH v2] " Siddharth Asthana
2022-04-14  8:19     ` Christian Couder
2022-04-14 16:42       ` Junio C Hamano
2022-04-16 13:55         ` Siddharth Asthana
2022-04-16 13:59           ` [PATCH v3] t1011: replace test -f with test_path_is* helpers Siddharth Asthana

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).