@@ -14,7 +14,7 @@ add_blob() {
14
14
BLOB=$( echo aleph_0 | git hash-object -w --stdin) &&
15
15
BLOB_FILE=.git/objects/$( echo $BLOB | sed " s/^../&\//" ) &&
16
16
test $(( 1 + $before )) = $( git count-objects | sed " s/ .*//" ) &&
17
- test -f $BLOB_FILE &&
17
+ test_path_is_file $BLOB_FILE &&
18
18
test-chmtime =+0 $BLOB_FILE
19
19
}
20
20
@@ -35,9 +35,9 @@ test_expect_success 'prune stale packs' '
35
35
: > .git/objects/tmp_2.pack &&
36
36
test-chmtime =-86501 .git/objects/tmp_1.pack &&
37
37
git prune --expire 1.day &&
38
- test -f $orig_pack &&
39
- test -f .git/objects/tmp_2.pack &&
40
- ! test -f .git/objects/tmp_1.pack
38
+ test_path_is_file $orig_pack &&
39
+ test_path_is_file .git/objects/tmp_2.pack &&
40
+ test_path_is_missing .git/objects/tmp_1.pack
41
41
42
42
'
43
43
@@ -46,11 +46,11 @@ test_expect_success 'prune --expire' '
46
46
add_blob &&
47
47
git prune --expire=1.hour.ago &&
48
48
test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
49
- test -f $BLOB_FILE &&
49
+ test_path_is_file $BLOB_FILE &&
50
50
test-chmtime =-86500 $BLOB_FILE &&
51
51
git prune --expire 1.day &&
52
52
test $before = $(git count-objects | sed "s/ .*//") &&
53
- ! test -f $BLOB_FILE
53
+ test_path_is_missing $BLOB_FILE
54
54
55
55
'
56
56
@@ -60,11 +60,11 @@ test_expect_success 'gc: implicit prune --expire' '
60
60
test-chmtime =-$((2*$week-30)) $BLOB_FILE &&
61
61
git gc &&
62
62
test $((1 + $before)) = $(git count-objects | sed "s/ .*//") &&
63
- test -f $BLOB_FILE &&
63
+ test_path_is_file $BLOB_FILE &&
64
64
test-chmtime =-$((2*$week+1)) $BLOB_FILE &&
65
65
git gc &&
66
66
test $before = $(git count-objects | sed "s/ .*//") &&
67
- ! test -f $BLOB_FILE
67
+ test_path_is_missing $BLOB_FILE
68
68
69
69
'
70
70
@@ -110,7 +110,7 @@ test_expect_success 'prune: do not prune detached HEAD with no reflog' '
110
110
git commit --allow-empty -m "detached commit" &&
111
111
# verify that there is no reflogs
112
112
# (should be removed and disabled by previous test)
113
- test ! -e .git/logs &&
113
+ test_path_is_missing .git/logs &&
114
114
git prune -n >prune_actual &&
115
115
: >prune_expected &&
116
116
test_cmp prune_actual prune_expected
@@ -145,18 +145,18 @@ test_expect_success 'gc --no-prune' '
145
145
git config gc.pruneExpire 2.days.ago &&
146
146
git gc --no-prune &&
147
147
test 1 = $(git count-objects | sed "s/ .*//") &&
148
- test -f $BLOB_FILE
148
+ test_path_is_file $BLOB_FILE
149
149
150
150
'
151
151
152
152
test_expect_success ' gc respects gc.pruneExpire' '
153
153
154
154
git config gc.pruneExpire 5002.days.ago &&
155
155
git gc &&
156
- test -f $BLOB_FILE &&
156
+ test_path_is_file $BLOB_FILE &&
157
157
git config gc.pruneExpire 5000.days.ago &&
158
158
git gc &&
159
- test ! -f $BLOB_FILE
159
+ test_path_is_missing $BLOB_FILE
160
160
161
161
'
162
162
@@ -165,19 +165,19 @@ test_expect_success 'gc --prune=<date>' '
165
165
add_blob &&
166
166
test-chmtime =-$((5001*$day)) $BLOB_FILE &&
167
167
git gc --prune=5002.days.ago &&
168
- test -f $BLOB_FILE &&
168
+ test_path_is_file $BLOB_FILE &&
169
169
git gc --prune=5000.days.ago &&
170
- test ! -f $BLOB_FILE
170
+ test_path_is_missing $BLOB_FILE
171
171
172
172
'
173
173
174
174
test_expect_success ' gc --prune=never' '
175
175
176
176
add_blob &&
177
177
git gc --prune=never &&
178
- test -f $BLOB_FILE &&
178
+ test_path_is_file $BLOB_FILE &&
179
179
git gc --prune=now &&
180
- test ! -f $BLOB_FILE
180
+ test_path_is_missing $BLOB_FILE
181
181
182
182
'
183
183
@@ -186,20 +186,20 @@ test_expect_success 'gc respects gc.pruneExpire=never' '
186
186
git config gc.pruneExpire never &&
187
187
add_blob &&
188
188
git gc &&
189
- test -f $BLOB_FILE &&
189
+ test_path_is_file $BLOB_FILE &&
190
190
git config gc.pruneExpire now &&
191
191
git gc &&
192
- test ! -f $BLOB_FILE
192
+ test_path_is_missing $BLOB_FILE
193
193
194
194
'
195
195
196
196
test_expect_success ' prune --expire=never' '
197
197
198
198
add_blob &&
199
199
git prune --expire=never &&
200
- test -f $BLOB_FILE &&
200
+ test_path_is_file $BLOB_FILE &&
201
201
git prune &&
202
- test ! -f $BLOB_FILE
202
+ test_path_is_missing $BLOB_FILE
203
203
204
204
'
205
205
@@ -210,10 +210,10 @@ test_expect_success 'gc: prune old objects after local clone' '
210
210
(
211
211
cd aclone &&
212
212
test 1 = $(git count-objects | sed "s/ .*//") &&
213
- test -f $BLOB_FILE &&
213
+ test_path_is_file $BLOB_FILE &&
214
214
git gc --prune &&
215
215
test 0 = $(git count-objects | sed "s/ .*//") &&
216
- ! test -f $BLOB_FILE
216
+ test_path_is_missing $BLOB_FILE
217
217
)
218
218
'
219
219
@@ -250,7 +250,7 @@ test_expect_success 'prune .git/shallow' '
250
250
grep $SHA1 .git/shallow &&
251
251
grep $SHA1 out &&
252
252
git prune &&
253
- ! test -f .git/shallow
253
+ test_path_is_missing .git/shallow
254
254
'
255
255
256
256
test_done
0 commit comments