{"thread":{"id":"57702","subject":"[GSoC] [PATCH] t1011: replace test -f with test_path_is_file","startedAt":"2022-04-09T11:45:38Z","lastAt":"2022-04-16T13:59:53Z","messageCount":8,"participants":["Siddharth Asthana","Junio C Hamano","Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"453367","messageId":"20220409114458.23435-1-siddharthasthana31@gmail.com","threadId":"57702","inReplyTo":null,"subject":"[GSoC] [PATCH] t1011: replace test -f with test_path_is_file","fromName":"Siddharth Asthana","fromEmail":"siddharthasthana31@gmail.com","sentAt":"2022-04-09T11:44:56Z","receivedAt":"2022-04-09T11:45:38Z","isPatch":true,"sender":{"key":"siddharthasthana31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53316982?v=4"},"body":"Use test_path_is_file() instead of 'test -f' for better debugging\ninformation.\n---\n t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------\n 1 file changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex dd957be1b7..c0b97a622e 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '\n@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-\n \tread_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n \tS subsub/added\n \tEOF\n \ttest_cmp expected.swt result &&\n-\t! test -f init.t &&\n-\t! test -f sub/added\n+\t! test_path_is_file init.t &&\n+\t! test_path_is_file sub/added\n '\n \n test_expect_success 'match directories with trailing slash' '\n@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t > result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\t! test_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories without trailing slash' '\n@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\t! test_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories with negated patterns' '\n@@ -129,9 +129,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation result &&\n-\ttest ! -f init.t &&\n-\ttest ! -f sub/added &&\n-\ttest -f sub/addedtoo\n+\t! test_path_is_file init.t &&\n+\t! test_path_is_file sub/added &&\n+\ttest_path_is_file sub/addedtoo\n '\n \n test_expect_success 'match directories with negated patterns (2)' '\n@@ -150,9 +150,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation2 result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added &&\n-\ttest ! -f sub/addedtoo\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added &&\n+\t! test_path_is_file sub/addedtoo\n '\n \n test_expect_success 'match directory pattern' '\n@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\t! test_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'checkout area changes' '\n@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-nosub result &&\n-\ttest -f init.t &&\n-\ttest ! -f sub/added\n+\ttest_path_is_file init.t &&\n+\t! test_path_is_file sub/added\n '\n \n test_expect_success 'read-tree updates worktree, absent case' '\n \techo sub/added >.git/info/sparse-checkout &&\n \tgit checkout -f top &&\n \tread_tree_u_must_succeed -m -u HEAD^ &&\n-\ttest ! -f init.t\n+\t! test_path_is_file init.t\n '\n \n test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '\n@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout -f removed &&\n \tread_tree_u_must_succeed -u -m HEAD^ &&\n-\ttest ! -f sub/added\n+\t! test_path_is_file sub/added\n '\n \n test_expect_success 'read-tree adds to worktree, dirty case' '\n@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout removed &&\n \tgit ls-files sub/added >result &&\n-\ttest ! -f sub/added &&\n+\t! test_path_is_file sub/added &&\n \ttest_must_be_empty result\n '\n \n-- \n2.35.1\n\n"},{"id":"453424","messageId":"xmqq1qy3igif.fsf@gitster.g","threadId":"57702","inReplyTo":"20220409114458.23435-1-siddharthasthana31@gmail.com","subject":"Re: [GSoC] [PATCH] t1011: replace test -f with test_path_is_file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-11T19:09:28Z","receivedAt":"2022-04-11T19:09:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Siddharth Asthana <siddharthasthana31@gmail.com> writes:\n\n> Use test_path_is_file() instead of 'test -f' for better debugging\n> information.\n> ---\n\nmissing Sign-off.\n\n>  \ttest_cmp expected.swt result &&\n> -\t! test -f init.t &&\n> -\t! test -f sub/added\n> +\t! test_path_is_file init.t &&\n> +\t! test_path_is_file sub/added\n>  '\n\nGiven the definition of the helper function, i.e.\n\n        test_path_is_file () {\n                test \"$#\" -ne 1 && BUG \"1 param\"\n                if ! test -f \"$1\"\n                then\n                        echo \"File $1 doesn't exist\"\n                        false\n                fi\n        }\n\nthe new test will _complain_ \"init.t doesn't exist\" when we have\nsuccessfully run the test, while it will be _silent_ when init.t\nthat _should_ not exist is there.\n\nWhich is the complete opposite of the spirit of why we want to use\nthe helper when we expect the path \"$1\" to exist, i.e. loudly fail\nwhen our expectation is _not_ met.\n\n$ git grep '! test_path_is' t/\n\nshows that we already have such a misuse of test_path_is_dir in one\nplace, but luckily we do not have any for test_path_is_file or other\nsimilar helpers.  test_path_is_hidden is sort-of OK as that is not\nabout verbosity.\n\nIn these two test, we do not expect init.t or sub/added to _exist_\nat all.  It's not like we are happy if we see init.d exist as a\ndirectory (which is not a file).  test_path_is_missing is probably\nthe right helper to use.\n\nIt is not very plausible that we'd want to assert that existence of\na path as a file the only bad condition (i.e. we are happy if the\npath did not exist or it is a directory, symlink, or a socket), so I\nthink the simple \n\n\tNever use '! test_path_is_file'; test_path_is_missing may be\n\twhat you are looking for.\n\nis a good enough rule.\n\nIf not, we could allow the caller to write such a convoluted \"only\nexistence of a path as a file is unacceptable and everything else is\ngood\" assertion as\n\n    test_path_is_file ! init.d\n\nwith something like\n\n        test_path_is_file () {\n\t\texpecting_file=true\n\t\tif test \"$1\" = \"!\"\n\t\tthen\n\t\t\texpecting_file=false\n\t\t\tshift\n\t\tfi\n                test \"$#\" -ne 1 && BUG \"1 param\"\n                if test -f \"$1\"\n                then\n                \t$expecting_file || echo \"File $1 exists\"\n                        $expecting_file\n\t\telse\n\t\t\t$expecting_file && echo \"File $1 doesn't exist\"\n                        ! $expecting_file\n                fi\n        }\n\nbut I do not think we want to go that way.\n"},{"id":"453463","messageId":"5e1797de-e06a-c811-1e49-00e19b7e66c1@gmail.com","threadId":"57702","inReplyTo":"xmqq1qy3igif.fsf@gitster.g","subject":"Re: [GSoC] [PATCH] t1011: replace test -f with test_path_is_file","fromName":"Siddharth Asthana","fromEmail":"siddharthasthana31@gmail.com","sentAt":"2022-04-12T20:21:21Z","receivedAt":"2022-04-12T20:27:27Z","isPatch":true,"sender":{"key":"siddharthasthana31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53316982?v=4"},"body":"Thanks a lot Junio for the feedback. I will send a new patch fixing it.\n\nBest Wishes\nSiddharth\n"},{"id":"453464","messageId":"20220412203722.10484-1-siddharthasthana31@gmail.com","threadId":"57702","inReplyTo":"xmqq1qy3igif.fsf@gitster.g","subject":"[GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file","fromName":"Siddharth Asthana","fromEmail":"siddharthasthana31@gmail.com","sentAt":"2022-04-12T20:37:22Z","receivedAt":"2022-04-12T20:41:58Z","isPatch":true,"sender":{"key":"siddharthasthana31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53316982?v=4"},"body":"Use test_path_is_file() instead of 'test -f' for better debugging\ninformation.\n\nSigned-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>\n---\n t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------\n 1 file changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex dd957be1b7..63a553d7b3 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '\n@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-\n \tread_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n \tS subsub/added\n \tEOF\n \ttest_cmp expected.swt result &&\n-\t! test -f init.t &&\n-\t! test -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'match directories with trailing slash' '\n@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t > result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories without trailing slash' '\n@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories with negated patterns' '\n@@ -129,9 +129,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation result &&\n-\ttest ! -f init.t &&\n-\ttest ! -f sub/added &&\n-\ttest -f sub/addedtoo\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_missing sub/added &&\n+\ttest_path_is_file sub/addedtoo\n '\n \n test_expect_success 'match directories with negated patterns (2)' '\n@@ -150,9 +150,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation2 result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added &&\n-\ttest ! -f sub/addedtoo\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added &&\n+\ttest_path_is_missing sub/addedtoo\n '\n \n test_expect_success 'match directory pattern' '\n@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'checkout area changes' '\n@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-nosub result &&\n-\ttest -f init.t &&\n-\ttest ! -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'read-tree updates worktree, absent case' '\n \techo sub/added >.git/info/sparse-checkout &&\n \tgit checkout -f top &&\n \tread_tree_u_must_succeed -m -u HEAD^ &&\n-\ttest ! -f init.t\n+\ttest_path_is_missing init.t\n '\n \n test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '\n@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout -f removed &&\n \tread_tree_u_must_succeed -u -m HEAD^ &&\n-\ttest ! -f sub/added\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'read-tree adds to worktree, dirty case' '\n@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout removed &&\n \tgit ls-files sub/added >result &&\n-\ttest ! -f sub/added &&\n+\ttest_path_is_missing sub/added &&\n \ttest_must_be_empty result\n '\n \n-- \n2.35.2\n\n"},{"id":"453643","messageId":"CAP8UFD3RtQecxOQWVeapH1CYsMiY2+MoHeugb9bvOsFVnozy=w@mail.gmail.com","threadId":"57702","inReplyTo":"20220412203722.10484-1-siddharthasthana31@gmail.com","subject":"Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2022-04-14T08:19:07Z","receivedAt":"2022-04-14T08:19:24Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Wed, Apr 13, 2022 at 2:06 AM Siddharth Asthana\n<siddharthasthana31@gmail.com> wrote:\n>\n> Use test_path_is_file() instead of 'test -f' for better debugging\n> information.\n\nActually it looks like you are also using test_path_is_missing() now,\nso you might want to update the commit message, and maybe also the\ncommit subject.\n\nIn the commit message it might be nice if there were some explanations\nabout why `test_path_is_missing PATH` should be used instead of `!\ntest_path_is_file PATH` or `test ! -f PATH` or `! test -f PATH`.\n\nThe diff part of the patch looks good to me. Thanks!\n"},{"id":"453657","messageId":"xmqqy2071urp.fsf@gitster.g","threadId":"57702","inReplyTo":"CAP8UFD3RtQecxOQWVeapH1CYsMiY2+MoHeugb9bvOsFVnozy=w@mail.gmail.com","subject":"Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-14T16:42:34Z","receivedAt":"2022-04-14T17:02:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <christian.couder@gmail.com> writes:\n\n> In the commit message it might be nice if there were some explanations\n> about why `test_path_is_missing PATH` should be used instead of `!\n> test_path_is_file PATH` or `test ! -f PATH` or `! test -f PATH`.\n\nMeaning \"the original used '! test -f foo' but what it meant was\nthat it did not want to see 'foo' on the filesystem, regardless of\nits type, so it should have been '!test -e foo' to begin with\"?\n\nI guess it does not hurt, as the original would have passed by\nmistake if these paths were on the filesystem as directories, but\nthe new code would behave differently, and even if it is a \"bugfix\",\nit still is a behaviour change that may be worth explaining.\n\n> The diff part of the patch looks good to me. Thanks!\n"},{"id":"453772","messageId":"a1199b2f-c7ad-5d50-e36a-0d47b05c16c4@gmail.com","threadId":"57702","inReplyTo":"xmqqy2071urp.fsf@gitster.g","subject":"Re: [GSoC] [PATCH v2] t1011: replace test -f with test_path_is_file","fromName":"Siddharth Asthana","fromEmail":"siddharthasthana31@gmail.com","sentAt":"2022-04-16T13:55:39Z","receivedAt":"2022-04-16T13:56:08Z","isPatch":true,"sender":{"key":"siddharthasthana31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53316982?v=4"},"body":"Thanks a lot Christian and Junio for the review. I will send a patch to \nupdate the commit message.\n\nBest Wishes\nSiddharth\n"},{"id":"453773","messageId":"20220416135932.146811-1-siddharthasthana31@gmail.com","threadId":"57702","inReplyTo":"a1199b2f-c7ad-5d50-e36a-0d47b05c16c4@gmail.com","subject":"[PATCH v3] t1011: replace test -f with test_path_is* helpers","fromName":"Siddharth Asthana","fromEmail":"siddharthasthana31@gmail.com","sentAt":"2022-04-16T13:59:32Z","receivedAt":"2022-04-16T13:59:53Z","isPatch":true,"sender":{"key":"siddharthasthana31@gmail.com","avatar":"https://avatars.githubusercontent.com/u/53316982?v=4"},"body":"Replace 'test -f' with test_path_is_file for better debugging\ninformation.\n\nReplace '! test -f' with 'test_path_is_missing' helper instead of\n'! test_path_is_file'. It is because, in the test, when we write\n\n   ! test -f init.t &&\n   ! test -f sub/added\n\nwe do not expect init.t or sub/added to exist at all. But when we write\n\n   ! test_path_is_file init.t &&\n   ! test_path_is_file sub/added\n\nthe test will _complain_ \"init.t doesn't exist\" when the test runs\nsuccessully, while it will be _silent_ when init.t that should not exist\nis there. This is complete opposite of what we want to do in the test.\nWe want to fail loudly when our expectation is not met.\n\nSo, replace '! test -f' with 'test_path_is_missing', as we do not expect\nfoo to exist, rgardless of its type, i.e our expectation is met\nif the path did not exist or it is a directory, symlink or a socket.\n\nSigned-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>\n---\n t/t1011-read-tree-sparse-checkout.sh | 46 ++++++++++++++--------------\n 1 file changed, 23 insertions(+), 23 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex dd957be1b7..63a553d7b3 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-checkout and enabled' '\n@@ -67,8 +67,8 @@ test_expect_success 'read-tree --no-sparse-checkout with empty .git/info/sparse-\n \tread_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n@@ -85,8 +85,8 @@ test_expect_success 'read-tree with empty .git/info/sparse-checkout' '\n \tS subsub/added\n \tEOF\n \ttest_cmp expected.swt result &&\n-\t! test -f init.t &&\n-\t! test -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'match directories with trailing slash' '\n@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t > result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories without trailing slash' '\n@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'match directories with negated patterns' '\n@@ -129,9 +129,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation result &&\n-\ttest ! -f init.t &&\n-\ttest ! -f sub/added &&\n-\ttest -f sub/addedtoo\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_missing sub/added &&\n+\ttest_path_is_file sub/addedtoo\n '\n \n test_expect_success 'match directories with negated patterns (2)' '\n@@ -150,9 +150,9 @@ EOF\n \tgit read-tree -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-negation2 result &&\n-\ttest -f init.t &&\n-\ttest -f sub/added &&\n-\ttest ! -f sub/addedtoo\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_file sub/added &&\n+\ttest_path_is_missing sub/addedtoo\n '\n \n test_expect_success 'match directory pattern' '\n@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-noinit result &&\n-\ttest ! -f init.t &&\n-\ttest -f sub/added\n+\ttest_path_is_missing init.t &&\n+\ttest_path_is_file sub/added\n '\n \n test_expect_success 'checkout area changes' '\n@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '\n \tread_tree_u_must_succeed -m -u HEAD &&\n \tgit ls-files -t >result &&\n \ttest_cmp expected.swt-nosub result &&\n-\ttest -f init.t &&\n-\ttest ! -f sub/added\n+\ttest_path_is_file init.t &&\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'read-tree updates worktree, absent case' '\n \techo sub/added >.git/info/sparse-checkout &&\n \tgit checkout -f top &&\n \tread_tree_u_must_succeed -m -u HEAD^ &&\n-\ttest ! -f init.t\n+\ttest_path_is_missing init.t\n '\n \n test_expect_success 'read-tree will not throw away dirty changes, non-sparse' '\n@@ -229,7 +229,7 @@ test_expect_success 'read-tree adds to worktree, absent case' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout -f removed &&\n \tread_tree_u_must_succeed -u -m HEAD^ &&\n-\ttest ! -f sub/added\n+\ttest_path_is_missing sub/added\n '\n \n test_expect_success 'read-tree adds to worktree, dirty case' '\n@@ -248,7 +248,7 @@ test_expect_success 'index removal and worktree narrowing at the same time' '\n \techo init.t >.git/info/sparse-checkout &&\n \tgit checkout removed &&\n \tgit ls-files sub/added >result &&\n-\ttest ! -f sub/added &&\n+\ttest_path_is_missing sub/added &&\n \ttest_must_be_empty result\n '\n \n-- \n2.35.3\n\n"}]}