blob: df970d75845e782980835d853176acb580ab70d4 [file] [log] [blame]
Junio C Hamano8de7eeb2016-11-15 17:42:40 -08001#!/bin/sh
2
3test_description='pack-object compression configuration'
4
5. ./test-lib.sh
6
7# This should be moved to test-lib.sh together with the
8# copy in t0021 after both topics have graduated to 'master'.
9file_size () {
Johannes Schindelin5868bd82019-01-29 06:19:33 -080010 test-tool path-utils file-size "$1"
Junio C Hamano8de7eeb2016-11-15 17:42:40 -080011}
12
13test_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
20'
21
22while read expect config
23do
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
32 '
33done <<\EOF
34large -c core.compression=0
35small -c core.compression=9
36large -c core.compression=0 -c pack.compression=0
37large -c core.compression=9 -c pack.compression=0
38small -c core.compression=0 -c pack.compression=9
39small -c core.compression=9 -c pack.compression=9
40large -c pack.compression=0
41small -c pack.compression=9
42EOF
43
44test_done