]> git.ipfire.org Git - thirdparty/git.git/commit
test-tool: add a helper to synthesize large packfiles
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 8 May 2026 08:16:43 +0000 (08:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 9 May 2026 02:25:32 +0000 (11:25 +0900)
commit438886aecb7546e6c5ba68cf1afd7535136f8bb4
treed712a8c09047c87f9b6e9f6cbbb43723c6be94aa
parent17fa0775966dd9769864768c0fdc76d3cc2a01fb
test-tool: add a helper to synthesize large packfiles

To test Git's behavior with very large pack files, we need a way to
generate such files quickly.

A naive approach using only readily-available Git commands would take
over 10 hours for a 4GB pack file, which is prohibitive.

Side-stepping Git's machinery and actual zlib compression by writing
uncompressed content with the appropriate zlib header makes things
much faster. The fastest method using this approach generates many
small, unreachable blob objects and takes about 1.5 minutes for 4GB.
However, this cannot be used because we need to test git clone, which
requires a reachable commit history.

Generating many reachable commits with small, uncompressed blobs takes
about 4 minutes for 4GB. But this approach 1) does not reproduce the
issues we want to fix (which require individual objects larger than
4GB) and 2) is comparatively slow because of the many SHA-1
calculations.

The approach taken here generates a single large blob (filled with NUL
bytes), along with the trees and commits needed to make it reachable.
This takes about 2.5 minutes for 4.5GB, which is the fastest option
that produces a valid, clonable repository with an object large enough
to trigger the bugs we want to test.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
compat/zlib-compat.h
t/helper/meson.build
t/helper/test-synthesize.c [new file with mode: 0644]
t/helper/test-tool.c
t/helper/test-tool.h