Merge branch 'ls/p4-retry-thrice'
[gitweb.git] / t / t1050-large.sh
index 096dbffecc3d51478b643bd2f4dee92f507e1c1a..6fd264cff0d6de1961656c2cd1193d8ce37e9a1f 100755 (executable)
@@ -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