Skip to content

Commit 5d1c2d2

Browse files
committed
t: add an expensive test to verify that 4GB+ blobs can be staged/read
I should have added this test as soon as git-for-windows#6012 was opened. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent a60a705 commit 5d1c2d2

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

t/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ integration_tests = [
427427
't3703-add-magic-pathspec.sh',
428428
't3704-add-pathspec-file.sh',
429429
't3705-add-sparse-checkout.sh',
430+
't3706-add-4gb-file.sh',
430431
't3800-mktag.sh',
431432
't3900-i18n-commit.sh',
432433
't3901-i18n-patch.sh',

t/t3706-add-4gb-file.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2026 Johannes Schindelin
4+
#
5+
6+
test_description='add 4GB+ objects'
7+
8+
. ./test-lib.sh
9+
10+
if ! test_have_prereq EXPENSIVE,SIZE_T_IS_64BIT
11+
then
12+
skip_all='expensive 4GB blob test; enable on 64-bit with GIT_TEST_LONG=true'
13+
test_done
14+
fi
15+
16+
size_4gb=4294967296
17+
18+
test_expect_success 'set up a 4GB file' '
19+
test_atexit "rm -f large" &&
20+
# genrandom takes only an unsigned long...
21+
test-tool genrandom 123 $(($size_4gb-1)) >large &&
22+
printf 1 >>large
23+
'
24+
25+
test_expect_success 'add 4GB file' '
26+
git add large &&
27+
git cat-file -s :large >size-staged &&
28+
test $size_4gb = $(cat size-staged)
29+
'
30+
test_expect_success 'read 4GB loose object' '
31+
git -P show :large >read &&
32+
test_file_size read >size-read &&
33+
test $size_4gb = $(cat size-read)
34+
'
35+
36+
test_done

0 commit comments

Comments
 (0)