t/pack-refs-tests: use test_path_is_missing
The pack-refs tests previously used raw 'test -f' and 'test -e' checks with negation. Update them to use Git's standard helper function test_path_is_missing for consistency and clearer failure reporting. As suggested in review, replaced the negated 'test_path_exists' with test_path_is_missing to better reflect the expected absence of paths. Signed-off-by: Ritesh Singh Jadoun <riteshjd75@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ritesh Singh Jadoun committed
Mar 15, 2026 at 13:40 UTC
2f0503971716ac21f37a0822a39740324b89c054
1 file changed
+14
-14
t/pack-refs-tests.sh
+14
-14
@@ -61,13 +61,13 @@ test_expect_success 'see if a branch still exists after git ${pack_refs} --prune
61
test_expect_success 'see if git ${pack_refs} --prune remove ref files' '
62
git branch f &&
63
git ${pack_refs} --all --prune &&
64
- ! test -f .git/refs/heads/f
64
+ test_path_is_missing .git/refs/heads/f
65
'
66
67
test_expect_success 'see if git ${pack_refs} --prune removes empty dirs' '
68
git branch r/s/t &&
69
git ${pack_refs} --all --prune &&
70
- ! test -e .git/refs/heads/r
70
+ test_path_is_missing .git/refs/heads/r
71
'
72
73
test_expect_success 'git branch g should work when git branch g/h has been deleted' '
@@ -111,43 +111,43 @@ test_expect_success 'test excluded refs are not packed' '
111
git branch dont_pack2 &&
112
git branch pack_this &&
113
git ${pack_refs} --all --exclude "refs/heads/dont_pack*" &&
114
- test -f .git/refs/heads/dont_pack1 &&
115
- test -f .git/refs/heads/dont_pack2 &&
116
- ! test -f .git/refs/heads/pack_this'
114
+ test_path_is_file .git/refs/heads/dont_pack1 &&
115
+ test_path_is_file .git/refs/heads/dont_pack2 &&
116
+ test_path_is_missing .git/refs/heads/pack_this'
117
118
test_expect_success 'test --no-exclude refs clears excluded refs' '
119
git branch dont_pack3 &&
120
git branch dont_pack4 &&
121
git ${pack_refs} --all --exclude "refs/heads/dont_pack*" --no-exclude &&
122
- ! test -f .git/refs/heads/dont_pack3 &&
123
- ! test -f .git/refs/heads/dont_pack4'
122
+ test_path_is_missing .git/refs/heads/dont_pack3 &&
123
+ test_path_is_missing .git/refs/heads/dont_pack4'
124
125
test_expect_success 'test only included refs are packed' '
126
git branch pack_this1 &&
127
git branch pack_this2 &&
128
git tag dont_pack5 &&
129
git ${pack_refs} --include "refs/heads/pack_this*" &&
130
- test -f .git/refs/tags/dont_pack5 &&
131
- ! test -f .git/refs/heads/pack_this1 &&
132
- ! test -f .git/refs/heads/pack_this2'
130
+ test_path_is_file .git/refs/tags/dont_pack5 &&
131
+ test_path_is_missing .git/refs/heads/pack_this1 &&
132
+ test_path_is_missing .git/refs/heads/pack_this2'
133
134
test_expect_success 'test --no-include refs clears included refs' '
135
git branch pack1 &&
136
git branch pack2 &&
137
git ${pack_refs} --include "refs/heads/pack*" --no-include &&
138
- test -f .git/refs/heads/pack1 &&
139
- test -f .git/refs/heads/pack2'
138
+ test_path_is_file .git/refs/heads/pack1 &&
139
+ test_path_is_file .git/refs/heads/pack2'
140
141
test_expect_success 'test --exclude takes precedence over --include' '
142
git branch dont_pack5 &&
143
git ${pack_refs} --include "refs/heads/pack*" --exclude "refs/heads/pack*" &&
144
- test -f .git/refs/heads/dont_pack5'
144
+ test_path_is_file .git/refs/heads/dont_pack5'
145
146
test_expect_success 'see if up-to-date packed refs are preserved' '
147
git branch q &&
148
git ${pack_refs} --all --prune &&
149
git update-ref refs/heads/q refs/heads/q &&
150
- ! test -f .git/refs/heads/q
150
+ test_path_is_missing .git/refs/heads/q
151
'
152
153
test_expect_success 'pack, prune and repack' '