t0001: use test_path_is_*

t0001 predates the test_path_is_* helpers, and uses "test -f" and "test -d" directly. Using the helpers provides better debugging output, and are a little more robust. As opposed to "! test -d", test_path_is_missing will actually makes sure the path does not exist at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Mar 20, 2014 at 19:17 UTC 633734d4a13ace930b34c83d37b4e8a22ccf5a3b
1 file changed +18 -18
t/t0001-init.sh
+18 -18
@@ -199,13 +199,13 @@ test_expect_success 'init with --template (blank)' '
199 cd template-plain &&
200 git init
201 ) &&
202 - test -f template-plain/.git/info/exclude &&
202 + test_path_is_file template-plain/.git/info/exclude &&
203 (
204 mkdir template-blank &&
205 cd template-blank &&
206 git init --template=
207 ) &&
208 - ! test -f template-blank/.git/info/exclude
208 + test_path_is_missing template-blank/.git/info/exclude
209 '
210
211 test_expect_success 'init with init.templatedir set' '
@@ -263,7 +263,7 @@ test_expect_success 'init creates a new directory' '
263 rm -fr newdir &&
264 (
265 git init newdir &&
266 - test -d newdir/.git/refs
266 + test_path_is_dir newdir/.git/refs
267 )
268 '
269
@@ -271,7 +271,7 @@ test_expect_success 'init creates a new bare directory' '
271 rm -fr newdir &&
272 (
273 git init --bare newdir &&
274 - test -d newdir/refs
274 + test_path_is_dir newdir/refs
275 )
276 '
277
@@ -280,7 +280,7 @@ test_expect_success 'init recreates a directory' '
280 (
281 mkdir newdir &&
282 git init newdir &&
283 - test -d newdir/.git/refs
283 + test_path_is_dir newdir/.git/refs
284 )
285 '
286
@@ -289,14 +289,14 @@ test_expect_success 'init recreates a new bare directory' '
289 (
290 mkdir newdir &&
291 git init --bare newdir &&
292 - test -d newdir/refs
292 + test_path_is_dir newdir/refs
293 )
294 '
295
296 test_expect_success 'init creates a new deep directory' '
297 rm -fr newdir &&
298 git init newdir/a/b/c &&
299 - test -d newdir/a/b/c/.git/refs
299 + test_path_is_dir newdir/a/b/c/.git/refs
300 '
301
302 test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shared)' '
@@ -306,7 +306,7 @@ test_expect_success POSIXPERM 'init creates a new deep directory (umask vs. shar
306 # the repository itself should follow "shared"
307 umask 002 &&
308 git init --bare --shared=0660 newdir/a/b/c &&
309 - test -d newdir/a/b/c/refs &&
309 + test_path_is_dir newdir/a/b/c/refs &&
310 ls -ld newdir/a newdir/a/b > lsab.out &&
311 ! grep -v "^drwxrw[sx]r-x" lsab.out &&
312 ls -ld newdir/a/b/c > lsc.out &&
@@ -319,7 +319,7 @@ test_expect_success 'init notices EEXIST (1)' '
319 (
320 >newdir &&
321 test_must_fail git init newdir &&
322 - test -f newdir
322 + test_path_is_file newdir
323 )
324 '
325
@@ -329,7 +329,7 @@ test_expect_success 'init notices EEXIST (2)' '
329 mkdir newdir &&
330 >newdir/a
331 test_must_fail git init newdir/a/b &&
332 - test -f newdir/a
332 + test_path_is_file newdir/a
333 )
334 '
335
@@ -345,15 +345,15 @@ test_expect_success POSIXPERM,SANITY 'init notices EPERM' '
345 test_expect_success 'init creates a new bare directory with global --bare' '
346 rm -rf newdir &&
347 git --bare init newdir &&
348 - test -d newdir/refs
348 + test_path_is_dir newdir/refs
349 '
350
351 test_expect_success 'init prefers command line to GIT_DIR' '
352 rm -rf newdir &&
353 mkdir otherdir &&
354 GIT_DIR=otherdir git --bare init newdir &&
355 - test -d newdir/refs &&
356 - ! test -d otherdir/refs
355 + test_path_is_dir newdir/refs &&
356 + test_path_is_missing otherdir/refs
357 '
358
359 test_expect_success 'init with separate gitdir' '
@@ -361,7 +361,7 @@ test_expect_success 'init with separate gitdir' '
361 git init --separate-git-dir realgitdir newdir &&
362 echo "gitdir: `pwd`/realgitdir" >expected &&
363 test_cmp expected newdir/.git &&
364 - test -d realgitdir/refs
364 + test_path_is_dir realgitdir/refs
365 '
366
367 test_expect_success 're-init on .git file' '
@@ -375,8 +375,8 @@ test_expect_success 're-init to update git link' '
375 ) &&
376 echo "gitdir: `pwd`/surrealgitdir" >expected &&
377 test_cmp expected newdir/.git &&
378 - test -d surrealgitdir/refs &&
379 - ! test -d realgitdir/refs
378 + test_path_is_dir surrealgitdir/refs &&
379 + test_path_is_missing realgitdir/refs
380 '
381
382 test_expect_success 're-init to move gitdir' '
@@ -388,7 +388,7 @@ test_expect_success 're-init to move gitdir' '
388 ) &&
389 echo "gitdir: `pwd`/realgitdir" >expected &&
390 test_cmp expected newdir/.git &&
391 - test -d realgitdir/refs
391 + test_path_is_dir realgitdir/refs
392 '
393
394 test_expect_success SYMLINKS 're-init to move gitdir symlink' '
@@ -403,7 +403,7 @@ test_expect_success SYMLINKS 're-init to move gitdir symlink' '
403 echo "gitdir: `pwd`/realgitdir" >expected &&
404 test_cmp expected newdir/.git &&
405 test_cmp expected newdir/here &&
406 - test -d realgitdir/refs
406 + test_path_is_dir realgitdir/refs
407 '
408
409 test_done