summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-16 02:51:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-16 02:51:55 (GMT)
commitf0858342fe98eb16c598e8b7eadd0fad123a4cd9 (patch)
tree400a8d63c1df8daa24b3f51dddf10e496ff300df /t
parenta1fdc85f419022df5f2246b0444db4679e528e63 (diff)
parent867e40ff3a731d9cf4ab1900a83ca21a9c2c8fae (diff)
downloadgit-f0858342fe98eb16c598e8b7eadd0fad123a4cd9.zip
git-f0858342fe98eb16c598e8b7eadd0fad123a4cd9.tar.gz
git-f0858342fe98eb16c598e8b7eadd0fad123a4cd9.tar.bz2
Merge branch 'rs/large-zip'
"git archive --format=zip" learned to use zip64 extension when necessary to go beyond the 4GB limit. * rs/large-zip: t5004: require 64-bit support for big ZIP tests archive-zip: set version field for big files correctly archive-zip: support files bigger than 4GB archive-zip: support archives bigger than 4GB archive-zip: write ZIP dir entry directly to strbuf archive-zip: use strbuf for ZIP directory archive-zip: add tests for big ZIP archives
Diffstat (limited to 't')
-rwxr-xr-xt/t5004-archive-corner-cases.sh50
-rw-r--r--t/t5004/big-pack.zipbin0 -> 7373 bytes
2 files changed, 50 insertions, 0 deletions
diff --git a/t/t5004-archive-corner-cases.sh b/t/t5004-archive-corner-cases.sh
index cca2338..f6207f4 100755
--- a/t/t5004-archive-corner-cases.sh
+++ b/t/t5004-archive-corner-cases.sh
@@ -27,6 +27,9 @@ check_dir() {
test_cmp expect actual
}
+test_lazy_prereq UNZIP_ZIP64_SUPPORT '
+ "$GIT_UNZIP" -v | grep ZIP64_SUPPORT
+'
# bsdtar/libarchive versions before 3.1.3 consider a tar file with a
# global pax header that is not followed by a file record as corrupt.
@@ -155,4 +158,51 @@ test_expect_success ZIPINFO 'zip archive with many entries' '
test_cmp expect actual
'
+test_expect_success EXPENSIVE,UNZIP,UNZIP_ZIP64_SUPPORT \
+ 'zip archive bigger than 4GB' '
+ # build string containing 65536 characters
+ s=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef &&
+ s=$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s &&
+ s=$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s$s &&
+
+ # create blob with a length of 65536 + 1 bytes
+ blob=$(echo $s | git hash-object -w --stdin) &&
+
+ # create tree containing 65500 entries of that blob
+ for i in $(test_seq 1 65500)
+ do
+ echo "100644 blob $blob $i"
+ done >tree &&
+ tree=$(git mktree <tree) &&
+
+ # zip it, creating an archive a bit bigger than 4GB
+ git archive -0 -o many-big.zip $tree &&
+
+ "$GIT_UNZIP" -t many-big.zip 9999 65500 &&
+ "$GIT_UNZIP" -t many-big.zip
+'
+
+test_expect_success EXPENSIVE,LONG_IS_64BIT,UNZIP,UNZIP_ZIP64_SUPPORT,ZIPINFO \
+ 'zip archive with files bigger than 4GB' '
+ # Pack created with:
+ # dd if=/dev/zero of=file bs=1M count=4100 && git hash-object -w file
+ mkdir -p .git/objects/pack &&
+ (
+ cd .git/objects/pack &&
+ "$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/big-pack.zip
+ ) &&
+ blob=754a93d6fada4c6873360e6cb4b209132271ab0e &&
+ size=$(expr 4100 "*" 1024 "*" 1024) &&
+
+ # create a tree containing the file
+ tree=$(echo "100644 blob $blob big-file" | git mktree) &&
+
+ # zip it, creating an archive with a file bigger than 4GB
+ git archive -o big.zip $tree &&
+
+ "$GIT_UNZIP" -t big.zip &&
+ "$ZIPINFO" big.zip >big.lst &&
+ grep $size big.lst
+'
+
test_done
diff --git a/t/t5004/big-pack.zip b/t/t5004/big-pack.zip
new file mode 100644
index 0000000..caaf614
--- /dev/null
+++ b/t/t5004/big-pack.zip
Binary files differ