Skip to content

Commit 40ba6b4

Browse files
committed
t5608: add regression test for >4GB object clone
The shift overflow bug in index-pack and unpack-objects caused incorrect object size calculation when the encoded size required more than 32 bits of shift. This would result in corrupted or failed unpacking of objects larger than 4GB. Add a test that creates a pack file containing a 4GB+ blob using the new 'test-tool synthesize pack --reachable-large' command, then clones the repository to verify the fix works correctly. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent e1ba5ae commit 40ba6b4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

t/t5608-clone-2gb.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,15 @@ test_expect_success 'clone - with worktree, file:// protocol' '
4949
5050
'
5151

52+
test_expect_success 'clone with >4GB object' '
53+
# Generate a pack with a single >4GB blob to test the shift overflow fix.
54+
# The bug causes size calculation to overflow when shift > 32 bits.
55+
git init --bare 4gb-repo &&
56+
head_oid=$(test-tool synthesize pack $((4*1024*1024*1024+1)) 4gb-repo/objects/pack/test.pack) &&
57+
git -C 4gb-repo index-pack objects/pack/test.pack &&
58+
git -C 4gb-repo update-ref refs/heads/main $head_oid &&
59+
60+
git clone --no-checkout --bare 4gb-repo 4gb-clone
61+
'
62+
5263
test_done

0 commit comments

Comments
 (0)