t1011: replace test -f with test_path_is_file

Use test_path_is_file() instead of 'test -f' for better debugging information. Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Siddharth Asthana committed Apr 13, 2022 at 02:07 UTC 72315e431b48c1239f143c5257f8a84aac3f3d2d
1 file changed +23 -23
t/t1011-read-tree-sparse-checkout.sh
+23 -23
@@ -57,8 +57,8 @@ test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' '
57 read_tree_u_must_succeed -m -u HEAD &&
58 git ls-files -t >result &&
59 test_cmp expected.swt result &&
60 - test -f init.t &&
61 - test -f sub/added
60 + test_path_is_file init.t &&
61 + test_path_is_file sub/added
62 '
63
64 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-
67 read_tree_u_must_succeed --no-sparse-checkout -m -u HEAD &&
68 git ls-files -t >result &&
69 test_cmp expected.swt result &&
70 - test -f init.t &&
71 - test -f sub/added
70 + test_path_is_file init.t &&
71 + test_path_is_file sub/added
72 '
73
74 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' '
85 S subsub/added
86 EOF
87 test_cmp expected.swt result &&
88 - ! test -f init.t &&
89 - ! test -f sub/added
88 + test_path_is_missing init.t &&
89 + test_path_is_missing sub/added
90 '
91
92 test_expect_success 'match directories with trailing slash' '
@@ -101,8 +101,8 @@ test_expect_success 'match directories with trailing slash' '
101 read_tree_u_must_succeed -m -u HEAD &&
102 git ls-files -t > result &&
103 test_cmp expected.swt-noinit result &&
104 - test ! -f init.t &&
105 - test -f sub/added
104 + test_path_is_missing init.t &&
105 + test_path_is_file sub/added
106 '
107
108 test_expect_success 'match directories without trailing slash' '
@@ -110,8 +110,8 @@ test_expect_success 'match directories without trailing slash' '
110 read_tree_u_must_succeed -m -u HEAD &&
111 git ls-files -t >result &&
112 test_cmp expected.swt-noinit result &&
113 - test ! -f init.t &&
114 - test -f sub/added
113 + test_path_is_missing init.t &&
114 + test_path_is_file sub/added
115 '
116
117 test_expect_success 'match directories with negated patterns' '
@@ -129,9 +129,9 @@ EOF
129 git read-tree -m -u HEAD &&
130 git ls-files -t >result &&
131 test_cmp expected.swt-negation result &&
132 - test ! -f init.t &&
133 - test ! -f sub/added &&
134 - test -f sub/addedtoo
132 + test_path_is_missing init.t &&
133 + test_path_is_missing sub/added &&
134 + test_path_is_file sub/addedtoo
135 '
136
137 test_expect_success 'match directories with negated patterns (2)' '
@@ -150,9 +150,9 @@ EOF
150 git read-tree -m -u HEAD &&
151 git ls-files -t >result &&
152 test_cmp expected.swt-negation2 result &&
153 - test -f init.t &&
154 - test -f sub/added &&
155 - test ! -f sub/addedtoo
153 + test_path_is_file init.t &&
154 + test_path_is_file sub/added &&
155 + test_path_is_missing sub/addedtoo
156 '
157
158 test_expect_success 'match directory pattern' '
@@ -160,8 +160,8 @@ test_expect_success 'match directory pattern' '
160 read_tree_u_must_succeed -m -u HEAD &&
161 git ls-files -t >result &&
162 test_cmp expected.swt-noinit result &&
163 - test ! -f init.t &&
164 - test -f sub/added
163 + test_path_is_missing init.t &&
164 + test_path_is_file sub/added
165 '
166
167 test_expect_success 'checkout area changes' '
@@ -176,15 +176,15 @@ test_expect_success 'checkout area changes' '
176 read_tree_u_must_succeed -m -u HEAD &&
177 git ls-files -t >result &&
178 test_cmp expected.swt-nosub result &&
179 - test -f init.t &&
180 - test ! -f sub/added
179 + test_path_is_file init.t &&
180 + test_path_is_missing sub/added
181 '
182
183 test_expect_success 'read-tree updates worktree, absent case' '
184 echo sub/added >.git/info/sparse-checkout &&
185 git checkout -f top &&
186 read_tree_u_must_succeed -m -u HEAD^ &&
187 - test ! -f init.t
187 + test_path_is_missing init.t
188 '
189
190 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' '
229 echo init.t >.git/info/sparse-checkout &&
230 git checkout -f removed &&
231 read_tree_u_must_succeed -u -m HEAD^ &&
232 - test ! -f sub/added
232 + test_path_is_missing sub/added
233 '
234
235 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' '
248 echo init.t >.git/info/sparse-checkout &&
249 git checkout removed &&
250 git ls-files sub/added >result &&
251 - test ! -f sub/added &&
251 + test_path_is_missing sub/added &&
252 test_must_be_empty result
253 '
254