From: Johannes Schindelin via GitGitGadget Date: Tue, 28 Apr 2026 16:26:14 GMT Subject: [PATCH 0/6] Handle cloning of objects larger than 4GB on Windows Message-ID: On Windows, unsigned long is 32-bit even on 64-bit systems. This causes multiple problems when Git handles objects larger than 4GB. This patch series is a very targeted fix for a very early part of the problem: it addresses the most fundamental truncation points that prevent a >4GB object from surviving a clone at all. Specifically, this fixes: * zlib's uLong wrapping and triggering BUG() assertions in the git_zstream wrapper * Object sizes being truncated in pack streaming, delta headers, and index-pack/unpack-objects * pack-objects re-encoding reused pack entries with a truncated size, producing corrupt packs on the wire Many other code paths still use unsigned long for object sizes (e.g., cat-file -s, object_info.sizep, the delta machinery) and will need their own conversions. This series does not attempt to fix those. Based on work by @LordKiRon in git-for-windows/git#6076. The last two commits add a test helper that synthesizes a pack with a >4GB blob and regression tests that clone it via both the unpack-objects and index-pack code paths using file:// transport. Johannes Schindelin (6): index-pack, unpack-objects: use size_t for object size git-zlib: handle data streams larger than 4GB odb, packfile: use size_t for streaming object sizes delta, packfile: use size_t for delta header sizes test-tool: add a helper to synthesize large packfiles t5608: add regression test for >4GB object clone Makefile | 1 + builtin/index-pack.c | 9 +- builtin/pack-objects.c | 23 +++- builtin/unpack-objects.c | 5 +- compat/zlib-compat.h | 2 + delta.h | 14 +- git-zlib.c | 25 ++-- git-zlib.h | 4 +- object-file.c | 12 +- odb/streaming.c | 13 +- odb/streaming.h | 2 +- oss-fuzz/fuzz-pack-headers.c | 2 +- pack-bitmap.c | 2 +- pack-check.c | 6 +- packfile.c | 57 +++++--- packfile.h | 4 +- t/helper/meson.build | 1 + t/helper/test-synthesize.c | 250 +++++++++++++++++++++++++++++++++++ t/helper/test-tool.c | 1 + t/helper/test-tool.h | 1 + t/t5608-clone-2gb.sh | 37 ++++++ 21 files changed, 418 insertions(+), 53 deletions(-) create mode 100644 t/helper/test-synthesize.c base-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2102%2Fdscho%2Ffix-large-clones-on-windows-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2102/dscho/fix-large-clones-on-windows-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/2102 -- gitgitgadget