Skip to content

Commit da59201

Browse files
committed
Merge branch 'rm/t2400-modernize'
Test clean-up. * rm/t2400-modernize: t2400: replace 'test -[efd]' with 'test_path_is_*'
2 parents 1e60e1d + 855cfc6 commit da59201

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

t/t2400-worktree-add.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ test_expect_success '"add" using - shorthand' '
4242

4343
test_expect_success '"add" refuses to checkout locked branch' '
4444
test_must_fail git worktree add zere main &&
45-
! test -d zere &&
46-
! test -d .git/worktrees/zere
45+
test_path_is_missing zere &&
46+
test_path_is_missing .git/worktrees/zere
4747
'
4848

4949
test_expect_success 'checking out paths not complaining about linked checkouts' '
@@ -70,14 +70,14 @@ test_expect_success '"add" worktree' '
7070
test_expect_success '"add" worktree with lock' '
7171
git worktree add --detach --lock here-with-lock main &&
7272
test_when_finished "git worktree unlock here-with-lock || :" &&
73-
test -f .git/worktrees/here-with-lock/locked
73+
test_path_is_file .git/worktrees/here-with-lock/locked
7474
'
7575

7676
test_expect_success '"add" worktree with lock and reason' '
7777
lock_reason="why not" &&
7878
git worktree add --detach --lock --reason "$lock_reason" here-with-lock-reason main &&
7979
test_when_finished "git worktree unlock here-with-lock-reason || :" &&
80-
test -f .git/worktrees/here-with-lock-reason/locked &&
80+
test_path_is_file .git/worktrees/here-with-lock-reason/locked &&
8181
echo "$lock_reason" >expect &&
8282
test_cmp expect .git/worktrees/here-with-lock-reason/locked
8383
'
@@ -412,14 +412,14 @@ test_expect_success '"add --orphan" with empty repository' '
412412
test_expect_success '"add" worktree with orphan branch and lock' '
413413
git worktree add --lock --orphan -b orphanbr orphan-with-lock &&
414414
test_when_finished "git worktree unlock orphan-with-lock || :" &&
415-
test -f .git/worktrees/orphan-with-lock/locked
415+
test_path_is_file .git/worktrees/orphan-with-lock/locked
416416
'
417417

418418
test_expect_success '"add" worktree with orphan branch, lock, and reason' '
419419
lock_reason="why not" &&
420420
git worktree add --detach --lock --reason "$lock_reason" orphan-with-lock-reason main &&
421421
test_when_finished "git worktree unlock orphan-with-lock-reason || :" &&
422-
test -f .git/worktrees/orphan-with-lock-reason/locked &&
422+
test_path_is_file .git/worktrees/orphan-with-lock-reason/locked &&
423423
echo "$lock_reason" >expect &&
424424
test_cmp expect .git/worktrees/orphan-with-lock-reason/locked
425425
'
@@ -474,7 +474,7 @@ test_expect_success 'local clone --shared from linked checkout' '
474474

475475
test_expect_success '"add" worktree with --no-checkout' '
476476
git worktree add --no-checkout -b swamp swamp &&
477-
! test -e swamp/init.t &&
477+
test_path_is_missing swamp/init.t &&
478478
git -C swamp reset --hard &&
479479
test_cmp init.t swamp/init.t
480480
'
@@ -497,7 +497,7 @@ test_expect_success 'put a worktree under rebase' '
497497

498498
test_expect_success 'add a worktree, checking out a rebased branch' '
499499
test_must_fail git worktree add new-rebase under-rebase &&
500-
! test -d new-rebase
500+
test_path_is_missing new-rebase
501501
'
502502

503503
test_expect_success 'checking out a rebased branch from another worktree' '
@@ -535,7 +535,7 @@ test_expect_success 'checkout a branch under bisect' '
535535
git worktree list >actual &&
536536
grep "under-bisect.*detached HEAD" actual &&
537537
test_must_fail git worktree add new-bisect under-bisect &&
538-
! test -d new-bisect
538+
test_path_is_missing new-bisect
539539
)
540540
'
541541

@@ -1165,7 +1165,7 @@ test_expect_success '"add" not tripped up by magic worktree matching"' '
11651165

11661166
test_expect_success FUNNYNAMES 'sanitize generated worktree name' '
11671167
git worktree add --detach ". weird*..?.lock.lock" &&
1168-
test -d .git/worktrees/---weird-.-
1168+
test_path_is_dir .git/worktrees/---weird-.-
11691169
'
11701170

11711171
test_expect_success '"add" should not fail because of another bad worktree' '

0 commit comments

Comments
 (0)