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