@@ -24,8 +24,8 @@ test_expect_success 'prune files inside $GIT_DIR/worktrees' '
2424Removing worktrees/abc: not a valid directory
2525EOF
2626 test_cmp expect actual &&
27- ! test -f .git/worktrees/abc &&
28- ! test -d .git/worktrees
27+ test_path_is_missing .git/worktrees/abc &&
28+ test_path_is_missing .git/worktrees
2929'
3030
3131test_expect_success ' prune directories without gitdir' '
@@ -36,8 +36,8 @@ Removing worktrees/def: gitdir file does not exist
3636EOF
3737 git worktree prune --verbose 2>actual &&
3838 test_cmp expect actual &&
39- ! test -d .git/worktrees/def &&
40- ! test -d .git/worktrees
39+ test_path_is_missing .git/worktrees/def &&
40+ test_path_is_missing .git/worktrees
4141'
4242
4343test_expect_success SANITY ' prune directories with unreadable gitdir' '
@@ -47,8 +47,8 @@ test_expect_success SANITY 'prune directories with unreadable gitdir' '
4747 chmod u-r .git/worktrees/def/gitdir &&
4848 git worktree prune --verbose 2>actual &&
4949 test_grep "Removing worktrees/def: unable to read gitdir file" actual &&
50- ! test -d .git/worktrees/def &&
51- ! test -d .git/worktrees
50+ test_path_is_missing .git/worktrees/def &&
51+ test_path_is_missing .git/worktrees
5252'
5353
5454test_expect_success ' prune directories with invalid gitdir' '
@@ -57,8 +57,8 @@ test_expect_success 'prune directories with invalid gitdir' '
5757 : >.git/worktrees/def/gitdir &&
5858 git worktree prune --verbose 2>actual &&
5959 test_grep "Removing worktrees/def: invalid gitdir file" actual &&
60- ! test -d .git/worktrees/def &&
61- ! test -d .git/worktrees
60+ test_path_is_missing .git/worktrees/def &&
61+ test_path_is_missing .git/worktrees
6262'
6363
6464test_expect_success ' prune directories with gitdir pointing to nowhere' '
@@ -67,32 +67,32 @@ test_expect_success 'prune directories with gitdir pointing to nowhere' '
6767 echo "$(pwd)"/nowhere >.git/worktrees/def/gitdir &&
6868 git worktree prune --verbose 2>actual &&
6969 test_grep "Removing worktrees/def: gitdir file points to non-existent location" actual &&
70- ! test -d .git/worktrees/def &&
71- ! test -d .git/worktrees
70+ test_path_is_missing .git/worktrees/def &&
71+ test_path_is_missing .git/worktrees
7272'
7373
7474test_expect_success ' not prune locked checkout' '
7575 test_when_finished rm -r .git/worktrees &&
7676 mkdir -p .git/worktrees/ghi &&
7777 : >.git/worktrees/ghi/locked &&
7878 git worktree prune &&
79- test -d .git/worktrees/ghi
79+ test_path_is_dir .git/worktrees/ghi
8080'
8181
8282test_expect_success ' not prune recent checkouts' '
8383 test_when_finished rm -r .git/worktrees &&
8484 git worktree add jlm HEAD &&
85- test -d .git/worktrees/jlm &&
85+ test_path_is_dir .git/worktrees/jlm &&
8686 rm -rf jlm &&
8787 git worktree prune --verbose --expire=2.days.ago &&
88- test -d .git/worktrees/jlm
88+ test_path_is_dir .git/worktrees/jlm
8989'
9090
9191test_expect_success ' not prune proper checkouts' '
9292 test_when_finished rm -r .git/worktrees &&
9393 git worktree add --detach "$PWD/nop" main &&
9494 git worktree prune &&
95- test -d .git/worktrees/nop
95+ test_path_is_dir .git/worktrees/nop
9696'
9797
9898test_expect_success ' prune duplicate (linked/linked)' '
@@ -103,8 +103,8 @@ test_expect_success 'prune duplicate (linked/linked)' '
103103 mv .git/worktrees/w2/gitdir.new .git/worktrees/w2/gitdir &&
104104 git worktree prune --verbose 2>actual &&
105105 test_grep "duplicate entry" actual &&
106- test -d .git/worktrees/w1 &&
107- ! test -d .git/worktrees/w2
106+ test_path_is_dir .git/worktrees/w1 &&
107+ test_path_is_missing .git/worktrees/w2
108108'
109109
110110test_expect_success ' prune duplicate (main/linked)' '
@@ -116,7 +116,7 @@ test_expect_success 'prune duplicate (main/linked)' '
116116 mv repo wt &&
117117 git -C wt worktree prune --verbose 2>actual &&
118118 test_grep "duplicate entry" actual &&
119- ! test -d .git/worktrees/wt
119+ test_path_is_missing .git/worktrees/wt
120120'
121121
122122test_expect_success ' not prune proper worktrees inside linked worktree with relative paths' '
0 commit comments