summaryrefslogtreecommitdiff
path: root/t/t1050-large.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-11-16 01:42:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-11-16 05:16:22 (GMT)
commit8de7eeb54b6aaa6d429b5d9c2b667847c35480ff (patch)
tree9855ab2f0cf5e5ec9ba2e6ae347730c0edced095 /t/t1050-large.sh
parent3ab228137f980ff72dbdf5064a877d07bec76df9 (diff)
downloadgit-8de7eeb54b6aaa6d429b5d9c2b667847c35480ff.zip
git-8de7eeb54b6aaa6d429b5d9c2b667847c35480ff.tar.gz
git-8de7eeb54b6aaa6d429b5d9c2b667847c35480ff.tar.bz2
compression: unify pack.compression configuration parsing
There are three codepaths that use a variable whose name is pack_compression_level to affect how objects and deltas sent to a packfile is compressed. Unlike zlib_compression_level that controls the loose object compression, however, this variable was static to each of these codepaths. Two of them read the pack.compression configuration variable, using core.compression as the default, and one of them also allowed overriding it from the command line. The other codepath in bulk-checkin did not pay any attention to the configuration. Unify the configuration parsing to git_default_config(), where we implement the parsing of core.loosecompression and core.compression and make the former override the latter, by moving code to parse pack.compression and also allow core.compression to give default to this variable. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1050-large.sh')
-rwxr-xr-xt/t1050-large.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/t1050-large.sh b/t/t1050-large.sh
index 096dbff..6fd264c 100755
--- a/t/t1050-large.sh
+++ b/t/t1050-large.sh
@@ -5,6 +5,12 @@ test_description='adding and checking out large blobs'
. ./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 '
# clone does not allow us to pass core.bigfilethreshold to
# new repos, so set core.bigfilethreshold globally
@@ -17,6 +23,29 @@ test_expect_success setup '
export GIT_ALLOC_LIMIT
'
+# add a large file with different settings
+while read expect config
+do
+ test_expect_success "add with $config" '
+ test_when_finished "rm -f .git/objects/pack/pack-*.* .git/index" &&
+ git $config add large1 &&
+ 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
+
test_expect_success 'add a large file or two' '
git add large1 huge large2 &&
# make sure we got a single packfile and no loose objects