Skip to content

Commit 2fca19f

Browse files
npitregitster
authored andcommitted
fix multiple issues with t5300
First of all, trying to run 'git verify-pack' on packs produced by the tests using pack.packSizeLimit always failed. After lots of digging and head scratching, it turns out that the preceeding test simulating a SHA1 collision did leave the repository quite confused, impacting subsequent tests. So let's move that destructive test last, and add tests to run verify-pack on the output from those packSizeLimit tests to catch such goofage. Finally, group those packSizeLimit tests together. Signed-off-by: Nicolas Pitre <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 57017b3 commit 2fca19f

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

t/t5300-pack-object.sh

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -280,26 +280,8 @@ test_expect_success \
280280
281281
:'
282282

283-
test_expect_success \
284-
'fake a SHA1 hash collision' \
285-
'test -f .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
286-
cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
287-
.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
288-
289-
test_expect_success \
290-
'make sure index-pack detects the SHA1 collision' \
291-
'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
292-
grep "SHA1 COLLISION FOUND" msg'
293-
294-
test_expect_success \
295-
'honor pack.packSizeLimit' \
296-
'git config pack.packSizeLimit 200 &&
297-
packname_4=$(git pack-objects test-4 <obj-list) &&
298-
test 3 = $(ls test-4-*.pack | wc -l)'
299-
300283
test_expect_success 'unpacking with --strict' '
301284
302-
git config --unset pack.packsizelimit &&
303285
for j in a b c d e f g
304286
do
305287
for i in 0 1 2 3 4 5 6 7 8 9
@@ -392,10 +374,42 @@ test_expect_success 'index-pack with --strict' '
392374
)
393375
'
394376

377+
test_expect_success 'honor pack.packSizeLimit' '
378+
git config pack.packSizeLimit 200 &&
379+
packname_10=$(git pack-objects test-10 <obj-list) &&
380+
test 3 = $(ls test-10-*.pack | wc -l)
381+
'
382+
383+
test_expect_success 'verify resulting packs' '
384+
git verify-pack test-10-*.pack
385+
'
386+
395387
test_expect_success 'tolerate absurdly small packsizelimit' '
396388
git config pack.packSizeLimit 2 &&
397-
packname_9=$(git pack-objects test-9 <obj-list) &&
398-
test $(wc -l <obj-list) = $(ls test-9-*.pack | wc -l)
389+
packname_11=$(git pack-objects test-11 <obj-list) &&
390+
test $(wc -l <obj-list) = $(ls test-11-*.pack | wc -l)
399391
'
400392

393+
test_expect_success 'verify resulting packs' '
394+
git verify-pack test-11-*.pack
395+
'
396+
397+
#
398+
# WARNING!
399+
#
400+
# The following test is destructive. Please keep the next
401+
# two tests at the end of this file.
402+
#
403+
404+
test_expect_success \
405+
'fake a SHA1 hash collision' \
406+
'test -f .git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67 &&
407+
cp -f .git/objects/9d/235ed07cd19811a6ceb342de82f190e49c9f68 \
408+
.git/objects/c8/2de19312b6c3695c0c18f70709a6c535682a67'
409+
410+
test_expect_success \
411+
'make sure index-pack detects the SHA1 collision' \
412+
'test_must_fail git index-pack -o bad.idx test-3.pack 2>msg &&
413+
grep "SHA1 COLLISION FOUND" msg'
414+
401415
test_done

0 commit comments

Comments
 (0)