Git fork

Merge branch 'so/t2401-use-test-path-helpers' into maint-2.51

Test modernization.

* so/t2401-use-test-path-helpers:
t2401: update path checks using test_path helpers

+17 -17
+17 -17
t/t2401-worktree-prune.sh
··· 24 24 Removing worktrees/abc: not a valid directory 25 25 EOF 26 26 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 29 29 ' 30 30 31 31 test_expect_success 'prune directories without gitdir' ' ··· 36 36 EOF 37 37 git worktree prune --verbose 2>actual && 38 38 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 41 41 ' 42 42 43 43 test_expect_success SANITY 'prune directories with unreadable gitdir' ' ··· 47 47 chmod u-r .git/worktrees/def/gitdir && 48 48 git worktree prune --verbose 2>actual && 49 49 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 52 52 ' 53 53 54 54 test_expect_success 'prune directories with invalid gitdir' ' ··· 57 57 : >.git/worktrees/def/gitdir && 58 58 git worktree prune --verbose 2>actual && 59 59 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 62 62 ' 63 63 64 64 test_expect_success 'prune directories with gitdir pointing to nowhere' ' ··· 67 67 echo "$(pwd)"/nowhere >.git/worktrees/def/gitdir && 68 68 git worktree prune --verbose 2>actual && 69 69 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 72 72 ' 73 73 74 74 test_expect_success 'not prune locked checkout' ' ··· 76 76 mkdir -p .git/worktrees/ghi && 77 77 : >.git/worktrees/ghi/locked && 78 78 git worktree prune && 79 - test -d .git/worktrees/ghi 79 + test_path_is_dir .git/worktrees/ghi 80 80 ' 81 81 82 82 test_expect_success 'not prune recent checkouts' ' 83 83 test_when_finished rm -r .git/worktrees && 84 84 git worktree add jlm HEAD && 85 - test -d .git/worktrees/jlm && 85 + test_path_is_dir .git/worktrees/jlm && 86 86 rm -rf jlm && 87 87 git worktree prune --verbose --expire=2.days.ago && 88 - test -d .git/worktrees/jlm 88 + test_path_is_dir .git/worktrees/jlm 89 89 ' 90 90 91 91 test_expect_success 'not prune proper checkouts' ' 92 92 test_when_finished rm -r .git/worktrees && 93 93 git worktree add --detach "$PWD/nop" main && 94 94 git worktree prune && 95 - test -d .git/worktrees/nop 95 + test_path_is_dir .git/worktrees/nop 96 96 ' 97 97 98 98 test_expect_success 'prune duplicate (linked/linked)' ' ··· 103 103 mv .git/worktrees/w2/gitdir.new .git/worktrees/w2/gitdir && 104 104 git worktree prune --verbose 2>actual && 105 105 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 108 108 ' 109 109 110 110 test_expect_success 'prune duplicate (main/linked)' ' ··· 116 116 mv repo wt && 117 117 git -C wt worktree prune --verbose 2>actual && 118 118 test_grep "duplicate entry" actual && 119 - ! test -d .git/worktrees/wt 119 + test_path_is_missing .git/worktrees/wt 120 120 ' 121 121 122 122 test_expect_success 'not prune proper worktrees inside linked worktree with relative paths' '