Merge branch 'main' of github.com:git/git
[alt-git.git] / t / t5315-pack-objects-compression.sh
blobc80ea9e8b71ee8707c8c1cc4020fb83a1b90029f
1 #!/bin/sh
3 test_description='pack-object compression configuration'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success setup '
9 printf "%2000000s" X |
10 git hash-object -w --stdin >object-name &&
11 # make sure it resulted in a loose object
12 ob=$(sed -e "s/\(..\).*/\1/" object-name) &&
13 ject=$(sed -e "s/..\(.*\)/\1/" object-name) &&
14 test -f .git/objects/$ob/$ject
17 while read expect config
19 test_expect_success "pack-objects with $config" '
20 test_when_finished "rm -f pack-*.*" &&
21 git $config pack-objects pack <object-name &&
22 sz=$(test_file_size pack-*.pack) &&
23 case "$expect" in
24 small) test "$sz" -le 100000 ;;
25 large) test "$sz" -ge 100000 ;;
26 esac
28 done <<\EOF
29 large -c core.compression=0
30 small -c core.compression=9
31 large -c core.compression=0 -c pack.compression=0
32 large -c core.compression=9 -c pack.compression=0
33 small -c core.compression=0 -c pack.compression=9
34 small -c core.compression=9 -c pack.compression=9
35 large -c pack.compression=0
36 small -c pack.compression=9
37 EOF
39 test_done