Browse Source
Compression setting for producing packfiles were spread across three codepaths, one of which did not honor any configuration. Unify these so that all of them honor core.compression and pack.compression variables the same way. * jc/compression-config: compression: unify pack.compression configuration parsingmaint
Junio C Hamano
8 years ago
9 changed files with 158 additions and 31 deletions
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description='pack-object compression configuration' |
||||
|
||||
. ./test-lib.sh |
||||
|
||||
# This should be moved to test-lib.sh together with the |
||||
# copy in t0021 after both topics have graduated to 'master'. |
||||
file_size () { |
||||
perl -e 'print -s $ARGV[0]' "$1" |
||||
} |
||||
|
||||
test_expect_success setup ' |
||||
printf "%2000000s" X | |
||||
git hash-object -w --stdin >object-name && |
||||
# make sure it resulted in a loose object |
||||
ob=$(sed -e "s/\(..\).*/\1/" object-name) && |
||||
ject=$(sed -e "s/..\(.*\)/\1/" object-name) && |
||||
test -f .git/objects/$ob/$ject |
||||
' |
||||
|
||||
while read expect config |
||||
do |
||||
test_expect_success "pack-objects with $config" ' |
||||
test_when_finished "rm -f pack-*.*" && |
||||
git $config pack-objects pack <object-name && |
||||
sz=$(file_size pack-*.pack) && |
||||
case "$expect" in |
||||
small) test "$sz" -le 100000 ;; |
||||
large) test "$sz" -ge 100000 ;; |
||||
esac |
||||
' |
||||
done <<\EOF |
||||
large -c core.compression=0 |
||||
small -c core.compression=9 |
||||
large -c core.compression=0 -c pack.compression=0 |
||||
large -c core.compression=9 -c pack.compression=0 |
||||
small -c core.compression=0 -c pack.compression=9 |
||||
small -c core.compression=9 -c pack.compression=9 |
||||
large -c pack.compression=0 |
||||
small -c pack.compression=9 |
||||
EOF |
||||
|
||||
test_done |
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
#!/bin/sh |
||||
|
||||
test_description='compression setting of fast-import utility' |
||||
. ./test-lib.sh |
||||
|
||||
# This should be moved to test-lib.sh together with the |
||||
# copy in t0021 after both topics have graduated to 'master'. |
||||
file_size () { |
||||
perl -e 'print -s $ARGV[0]' "$1" |
||||
} |
||||
|
||||
import_large () { |
||||
( |
||||
echo blob |
||||
echo "data <<EOD" |
||||
printf "%2000000s\n" "$*" |
||||
echo EOD |
||||
) | git "$@" fast-import |
||||
} |
||||
|
||||
while read expect config |
||||
do |
||||
test_expect_success "fast-import (packed) with $config" ' |
||||
test_when_finished "rm -f .git/objects/pack/pack-*.*" && |
||||
test_when_finished "rm -rf .git/objects/??" && |
||||
import_large -c fastimport.unpacklimit=0 $config && |
||||
sz=$(file_size .git/objects/pack/pack-*.pack) && |
||||
case "$expect" in |
||||
small) test "$sz" -le 100000 ;; |
||||
large) test "$sz" -ge 100000 ;; |
||||
esac |
||||
' |
||||
done <<\EOF |
||||
large -c core.compression=0 |
||||
small -c core.compression=9 |
||||
large -c core.compression=0 -c pack.compression=0 |
||||
large -c core.compression=9 -c pack.compression=0 |
||||
small -c core.compression=0 -c pack.compression=9 |
||||
small -c core.compression=9 -c pack.compression=9 |
||||
large -c pack.compression=0 |
||||
small -c pack.compression=9 |
||||
EOF |
||||
|
||||
while read expect config |
||||
do |
||||
test_expect_success "fast-import (loose) with $config" ' |
||||
test_when_finished "rm -f .git/objects/pack/pack-*.*" && |
||||
test_when_finished "rm -rf .git/objects/??" && |
||||
import_large -c fastimport.unpacklimit=9 $config && |
||||
sz=$(file_size .git/objects/??/????*) && |
||||
case "$expect" in |
||||
small) test "$sz" -le 100000 ;; |
||||
large) test "$sz" -ge 100000 ;; |
||||
esac |
||||
' |
||||
done <<\EOF |
||||
large -c core.compression=0 |
||||
small -c core.compression=9 |
||||
large -c core.compression=0 -c core.loosecompression=0 |
||||
large -c core.compression=9 -c core.loosecompression=0 |
||||
small -c core.compression=0 -c core.loosecompression=9 |
||||
small -c core.compression=9 -c core.loosecompression=9 |
||||
large -c core.loosecompression=0 |
||||
small -c core.loosecompression=9 |
||||
EOF |
||||
|
||||
test_done |
Loading…
Reference in new issue