277
'
278
279
# Test sparse:path=<path> filter.
280
+# !!!!
281
+# NOTE: sparse:path filter support has been dropped for security reasons,
282
+# so the tests have been changed to make sure that using it fails.
283
+# !!!!
284
# Use a local file containing a sparse-checkout specification to filter
285
# out blobs not required for the corresponding sparse-checkout. We do not
286
# require sparse-checkout to actually be enabled.
319
test_cmp expected observed
320
'
321
318
-test_expect_success 'verify sparse:path=pattern1' '
319
- git -C r3 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
320
- awk -f print_2.awk ls_files_result |
321
- sort >expected &&
322
-
323
- git -C r3 pack-objects --revs --stdout --filter=sparse:path=../pattern1 >filter.pack <<-EOF &&
322
+test_expect_success 'verify sparse:path=pattern1 fails' '
323
+ test_must_fail git -C r3 pack-objects --revs --stdout \
324
+ --filter=sparse:path=../pattern1 <<-EOF
325
HEAD
326
EOF
326
- git -C r3 index-pack ../filter.pack &&
327
-
328
- git -C r3 verify-pack -v ../filter.pack >verify_result &&
329
- grep blob verify_result |
330
- awk -f print_1.awk |
331
- sort >observed &&
332
-
333
- test_cmp expected observed
334
-'
335
-
336
-test_expect_success 'verify normal and sparse:path=pattern1 packfiles have same commits/trees' '
337
- git -C r3 verify-pack -v ../all.pack >verify_result &&
338
- grep -E "commit|tree" verify_result |
339
- awk -f print_1.awk |
340
- sort >expected &&
341
-
342
- git -C r3 verify-pack -v ../filter.pack >verify_result &&
343
- grep -E "commit|tree" verify_result |
344
- awk -f print_1.awk |
345
- sort >observed &&
346
-
347
- test_cmp expected observed
327
'
328
350
-test_expect_success 'verify sparse:path=pattern2' '
351
- git -C r3 ls-files -s sparse1 dir1/sparse1 >ls_files_result &&
352
- awk -f print_2.awk ls_files_result |
353
- sort >expected &&
354
-
355
- git -C r3 pack-objects --revs --stdout --filter=sparse:path=../pattern2 >filter.pack <<-EOF &&
329
+test_expect_success 'verify sparse:path=pattern2 fails' '
330
+ test_must_fail git -C r3 pack-objects --revs --stdout \
331
+ --filter=sparse:path=../pattern2 <<-EOF
332
HEAD
333
EOF
358
- git -C r3 index-pack ../filter.pack &&
359
-
360
- git -C r3 verify-pack -v ../filter.pack >verify_result &&
361
- grep blob verify_result |
362
- awk -f print_1.awk |
363
- sort >observed &&
364
-
365
- test_cmp expected observed
366
-'
367
-
368
-test_expect_success 'verify normal and sparse:path=pattern2 packfiles have same commits/trees' '
369
- git -C r3 verify-pack -v ../all.pack >verify_result &&
370
- grep -E "commit|tree" verify_result |
371
- awk -f print_1.awk |
372
- sort >expected &&
373
-
374
- git -C r3 verify-pack -v ../filter.pack >verify_result &&
375
- grep -E "commit|tree" verify_result |
376
- awk -f print_1.awk |
377
- sort >observed &&
378
-
379
- test_cmp expected observed
334
'
335
336
# Test sparse:oid=<oid-ish> filter.
383
-# Like sparse:path, but we get the sparse-checkout specification from
384
-# a blob rather than a file on disk.
337
+# Use a blob containing a sparse-checkout specification to filter
338
+# out blobs not required for the corresponding sparse-checkout. We do not
339
+# require sparse-checkout to actually be enabled.
340
341
test_expect_success 'setup r4' '
342
git init r4 &&