t5004: fix test creating an archive with large objects under SHA256

One of the tests in t5004 extracts a ZIP file that contains some objects
larger than 4GB and then double-checks whether we can read and archive
such an object. That test has a bunch of prerequities: it requires a 64
bit `long`, unzip with 64-bit support and it only runs when EXPENSIVE is
enabled. Consequently, not a lot of jobs even exercise this.

One of the jobs that does run it though is our Fedora-based job, as it
ticks all the necessary boxes. But that job was silently broken: while
the intent was to run on Fedora with breaking changes enabled, they are
in fact disabled due to a typo.

We're about to fix that typo in the next commit, but this will also
uncover that the above test case is broken when running in SHA-256
repositories. The extracted objects are SHA-1 objects, so extracting
them into a SHA-256 repository is not going to yield anything good. So
once we fix the Fedora-based job to enable breaking changes, which will
make tests use SHA-256 by default, the test will break.

Fix this issue by explicitly creating the repository with the SHA1
object format.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt authored and Junio C Hamano committed 2026-10-15 07:24:08 -07:00
1 parent a018953688
commit 5a7bcf02d0
1 file changed
+21 -15
+21 -15
View File
@@ -187,25 +187,31 @@ test_expect_success EXPENSIVE,UNZIP,UNZIP_ZIP64_SUPPORT \
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 &&
test_when_finished rm -rf big-file &&
git init --object-format=sha1 big-file &&
(
cd .git/objects/pack &&
"$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/big-pack.zip
) &&
blob=754a93d6fada4c6873360e6cb4b209132271ab0e &&
size=$(expr 4100 "*" 1024 "*" 1024) &&
cd big-file &&
# create a tree containing the file
tree=$(echo "100644 blob $blob big-file" | git mktree) &&
# 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) &&
# zip it, creating an archive with a file bigger than 4GB
git archive -o big.zip $tree &&
# create a tree containing the file
tree=$(echo "100644 blob $blob big-file" | git mktree) &&
"$GIT_UNZIP" -t big.zip &&
"$ZIPINFO" big.zip >big.lst &&
test_grep $size big.lst
# 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 &&
test_grep $size big.lst
)
'
build_tree() {