Merge branch 'ds/commit-graph-lockfile-fix'
[alt-git.git] / t / t5315-pack-objects-compression.sh
blob34c47dae09966bb3b1de8178769b078509625b1e
1 #!/bin/sh
3 test_description='pack-object compression configuration'
5 . ./test-lib.sh
7 # This should be moved to test-lib.sh together with the
8 # copy in t0021 after both topics have graduated to 'master'.
9 file_size () {
10 perl -e 'print -s $ARGV[0]' "$1"
13 test_expect_success setup '
14 printf "%2000000s" X |
15 git hash-object -w --stdin >object-name &&
16 # make sure it resulted in a loose object
17 ob=$(sed -e "s/\(..\).*/\1/" object-name) &&
18 ject=$(sed -e "s/..\(.*\)/\1/" object-name) &&
19 test -f .git/objects/$ob/$ject
22 while read expect config
24 test_expect_success "pack-objects with $config" '
25 test_when_finished "rm -f pack-*.*" &&
26 git $config pack-objects pack <object-name &&
27 sz=$(file_size pack-*.pack) &&
28 case "$expect" in
29 small) test "$sz" -le 100000 ;;
30 large) test "$sz" -ge 100000 ;;
31 esac
33 done <<\EOF
34 large -c core.compression=0
35 small -c core.compression=9
36 large -c core.compression=0 -c pack.compression=0
37 large -c core.compression=9 -c pack.compression=0
38 small -c core.compression=0 -c pack.compression=9
39 small -c core.compression=9 -c pack.compression=9
40 large -c pack.compression=0
41 small -c pack.compression=9
42 EOF
44 test_done