midx: implement `BTMP` chunk
[git/gitster.git] / t / t9303-fast-import-compression.sh
blob4f5bf40587cb03aeed5b564c21780010431008ba
1 #!/bin/sh
3 test_description='compression setting of fast-import utility'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 import_large () {
10 echo blob
11 echo "data <<EOD"
12 printf "%2000000s\n" "$*"
13 echo EOD
14 ) | git "$@" fast-import
17 while read expect config
19 test_expect_success "fast-import (packed) with $config" '
20 test_when_finished "rm -f .git/objects/pack/pack-*.*" &&
21 test_when_finished "rm -rf .git/objects/??" &&
22 import_large -c fastimport.unpacklimit=0 $config &&
23 sz=$(test_file_size .git/objects/pack/pack-*.pack) &&
24 case "$expect" in
25 small) test "$sz" -le 100000 ;;
26 large) test "$sz" -ge 100000 ;;
27 esac
29 done <<\EOF
30 large -c core.compression=0
31 small -c core.compression=9
32 large -c core.compression=0 -c pack.compression=0
33 large -c core.compression=9 -c pack.compression=0
34 small -c core.compression=0 -c pack.compression=9
35 small -c core.compression=9 -c pack.compression=9
36 large -c pack.compression=0
37 small -c pack.compression=9
38 EOF
40 while read expect config
42 test_expect_success "fast-import (loose) with $config" '
43 test_when_finished "rm -f .git/objects/pack/pack-*.*" &&
44 test_when_finished "rm -rf .git/objects/??" &&
45 import_large -c fastimport.unpacklimit=9 $config &&
46 sz=$(test_file_size .git/objects/??/????*) &&
47 case "$expect" in
48 small) test "$sz" -le 100000 ;;
49 large) test "$sz" -ge 100000 ;;
50 esac
52 done <<\EOF
53 large -c core.compression=0
54 small -c core.compression=9
55 large -c core.compression=0 -c core.loosecompression=0
56 large -c core.compression=9 -c core.loosecompression=0
57 small -c core.compression=0 -c core.loosecompression=9
58 small -c core.compression=9 -c core.loosecompression=9
59 large -c core.loosecompression=0
60 small -c core.loosecompression=9
61 EOF
63 test_done