2 # Copyright (c) 2011, Google Inc.
4 test_description
='adding and checking out large blobs'
8 test_expect_success setup
'
9 git config core.bigfilethreshold 200k &&
10 echo X | dd of=large1 bs=1k seek=2000 &&
11 echo X | dd of=large2 bs=1k seek=2000 &&
12 echo X | dd of=large3 bs=1k seek=2000 &&
13 echo Y | dd of=huge bs=1k seek=2500
16 test_expect_success
'add a large file or two' '
17 git add large1 huge large2 &&
18 # make sure we got a single packfile and no loose objects
20 for p in .git/objects/pack/pack-*.pack
22 count=$(( $count + 1 ))
23 if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"
31 cnt=$(git show-index <"$idx" | wc -l) &&
33 for l in .git/objects/??/??????????????????????????????????????
35 test -f "$l" || continue
40 # attempt to add another copy of the same
43 for p in .git/objects/pack/pack-*.pack
45 count=$(( $count + 1 ))
46 if test -f "$p" && idx=${p%.pack}.idx && test -f "$idx"
56 test_expect_success
'checkout a large file' '
57 large1=$(git rev-parse :large1) &&
58 git update-index --add --cacheinfo 100644 $large1 another &&
59 git checkout another &&
60 cmp large1 another ;# this must not be test_cmp
63 test_expect_success
'packsize limit' '
64 test_create_repo mid &&
67 git config core.bigfilethreshold 64k &&
68 git config pack.packsizelimit 256k &&
70 # mid1 and mid2 will fit within 256k limit but
71 # appending mid3 will bust the limit and will
72 # result in a separate packfile.
73 test-genrandom "a" $(( 66 * 1024 )) >mid1 &&
74 test-genrandom "b" $(( 80 * 1024 )) >mid2 &&
75 test-genrandom "c" $(( 128 * 1024 )) >mid3 &&
76 git add mid1 mid2 mid3 &&
79 for pi in .git/objects/pack/pack-*.idx
81 test -f "$pi" && count=$(( $count + 1 ))
86 git hash-object --stdin <mid1
87 git hash-object --stdin <mid2
88 git hash-object --stdin <mid3
92 for pi in .git/objects/pack/pack-*.idx
96 sed -e "s/^[0-9]* \([0-9a-f]*\) .*/\1/" |
99 test_cmp expect actual