@@ -24,8 +24,9 @@ parse_verify_pack_blob_oid () {
24
24
}
25
25
26
26
test_expect_success ' verify blob count in normal packfile' '
27
- git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
28
- test_parse_ls_files_stage_oids |
27
+ git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
28
+ >ls_files_result &&
29
+ test_parse_ls_files_stage_oids <ls_files_result |
29
30
sort >expected &&
30
31
31
32
git -C r1 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -123,8 +124,8 @@ test_expect_success 'setup r2' '
123
124
'
124
125
125
126
test_expect_success ' verify blob count in normal packfile' '
126
- git -C r2 ls-files -s large.1000 large.10000 |
127
- test_parse_ls_files_stage_oids |
127
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
128
+ test_parse_ls_files_stage_oids <ls_files_result |
128
129
sort >expected &&
129
130
130
131
git -C r2 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -161,8 +162,8 @@ test_expect_success 'verify blob:limit=1000' '
161
162
'
162
163
163
164
test_expect_success ' verify blob:limit=1001' '
164
- git -C r2 ls-files -s large.1000 |
165
- test_parse_ls_files_stage_oids |
165
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
166
+ test_parse_ls_files_stage_oids <ls_files_result |
166
167
sort >expected &&
167
168
168
169
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1001 >filter.pack <<-EOF &&
@@ -179,8 +180,8 @@ test_expect_success 'verify blob:limit=1001' '
179
180
'
180
181
181
182
test_expect_success ' verify blob:limit=10001' '
182
- git -C r2 ls-files -s large.1000 large.10000 |
183
- test_parse_ls_files_stage_oids |
183
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
184
+ test_parse_ls_files_stage_oids <ls_files_result |
184
185
sort >expected &&
185
186
186
187
git -C r2 pack-objects --revs --stdout --filter=blob:limit=10001 >filter.pack <<-EOF &&
@@ -197,8 +198,8 @@ test_expect_success 'verify blob:limit=10001' '
197
198
'
198
199
199
200
test_expect_success ' verify blob:limit=1k' '
200
- git -C r2 ls-files -s large.1000 |
201
- test_parse_ls_files_stage_oids |
201
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
202
+ test_parse_ls_files_stage_oids <ls_files_result |
202
203
sort >expected &&
203
204
204
205
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k >filter.pack <<-EOF &&
@@ -215,8 +216,8 @@ test_expect_success 'verify blob:limit=1k' '
215
216
'
216
217
217
218
test_expect_success ' verify explicitly specifying oversized blob in input' '
218
- git -C r2 ls-files -s large.1000 large.10000 |
219
- test_parse_ls_files_stage_oids |
219
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
220
+ test_parse_ls_files_stage_oids <ls_files_result |
220
221
sort >expected &&
221
222
222
223
echo HEAD >objects &&
@@ -233,8 +234,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' '
233
234
'
234
235
235
236
test_expect_success ' verify blob:limit=1m' '
236
- git -C r2 ls-files -s large.1000 large.10000 |
237
- test_parse_ls_files_stage_oids |
237
+ git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
238
+ test_parse_ls_files_stage_oids <ls_files_result |
238
239
sort >expected &&
239
240
240
241
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1m >filter.pack <<-EOF &&
@@ -264,6 +265,44 @@ test_expect_success 'verify normal and blob:limit packfiles have same commits/tr
264
265
test_cmp expected observed
265
266
'
266
267
268
+ test_expect_success ' verify small limit and big limit results in small limit' '
269
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
270
+ test_parse_ls_files_stage_oids <ls_files_result |
271
+ sort >expected &&
272
+
273
+ git -C r2 pack-objects --revs --stdout --filter=blob:limit=1001 \
274
+ --filter=blob:limit=10001 >filter.pack <<-EOF &&
275
+ HEAD
276
+ EOF
277
+ git -C r2 index-pack ../filter.pack &&
278
+
279
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
280
+ grep blob verify_result |
281
+ parse_verify_pack_blob_oid |
282
+ sort >observed &&
283
+
284
+ test_cmp expected observed
285
+ '
286
+
287
+ test_expect_success ' verify big limit and small limit results in small limit' '
288
+ git -C r2 ls-files -s large.1000 >ls_files_result &&
289
+ test_parse_ls_files_stage_oids <ls_files_result |
290
+ sort >expected &&
291
+
292
+ git -C r2 pack-objects --revs --stdout --filter=blob:limit=10001 \
293
+ --filter=blob:limit=1001 >filter.pack <<-EOF &&
294
+ HEAD
295
+ EOF
296
+ git -C r2 index-pack ../filter.pack &&
297
+
298
+ git -C r2 verify-pack -v ../filter.pack >verify_result &&
299
+ grep blob verify_result |
300
+ parse_verify_pack_blob_oid |
301
+ sort >observed &&
302
+
303
+ test_cmp expected observed
304
+ '
305
+
267
306
# Test sparse:path=<path> filter.
268
307
# !!!!
269
308
# NOTE: sparse:path filter support has been dropped for security reasons,
@@ -289,8 +328,9 @@ test_expect_success 'setup r3' '
289
328
'
290
329
291
330
test_expect_success ' verify blob count in normal packfile' '
292
- git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
293
- test_parse_ls_files_stage_oids |
331
+ git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
332
+ >ls_files_result &&
333
+ test_parse_ls_files_stage_oids <ls_files_result |
294
334
sort >expected &&
295
335
296
336
git -C r3 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -341,8 +381,9 @@ test_expect_success 'setup r4' '
341
381
'
342
382
343
383
test_expect_success ' verify blob count in normal packfile' '
344
- git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
345
- test_parse_ls_files_stage_oids |
384
+ git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
385
+ >ls_files_result &&
386
+ test_parse_ls_files_stage_oids <ls_files_result |
346
387
sort >expected &&
347
388
348
389
git -C r4 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -359,8 +400,8 @@ test_expect_success 'verify blob count in normal packfile' '
359
400
'
360
401
361
402
test_expect_success ' verify sparse:oid=OID' '
362
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
363
- test_parse_ls_files_stage_oids |
403
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
404
+ test_parse_ls_files_stage_oids <ls_files_result |
364
405
sort >expected &&
365
406
366
407
git -C r4 ls-files -s pattern >staged &&
@@ -379,8 +420,8 @@ test_expect_success 'verify sparse:oid=OID' '
379
420
'
380
421
381
422
test_expect_success ' verify sparse:oid=oid-ish' '
382
- git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
383
- test_parse_ls_files_stage_oids |
423
+ git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
424
+ test_parse_ls_files_stage_oids <ls_files_result |
384
425
sort >expected &&
385
426
386
427
git -C r4 pack-objects --revs --stdout --filter=sparse:oid=main:pattern >filter.pack <<-EOF &&
@@ -400,8 +441,9 @@ test_expect_success 'verify sparse:oid=oid-ish' '
400
441
# This models previously omitted objects that we did not receive.
401
442
402
443
test_expect_success ' setup r1 - delete loose blobs' '
403
- git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
404
- test_parse_ls_files_stage_oids |
444
+ git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
445
+ >ls_files_result &&
446
+ test_parse_ls_files_stage_oids <ls_files_result |
405
447
sort >expected &&
406
448
407
449
for id in `cat expected | sed "s|..|&/|"`
0 commit comments