3 test_description
='check receive input limits'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 # Let's run tests with different unpack limits: 1 and 10000
9 # When the limit is 1, `git receive-pack` will call `git index-pack`.
10 # When the limit is 10000, `git receive-pack` will call `git unpack-objects`.
12 test_pack_input_limit
() {
14 index
) unpack_limit
=1 ;;
15 unpack
) unpack_limit
=10000 ;;
18 test_expect_success
'prepare destination repository' '
23 test_expect_success
"set unpacklimit to $unpack_limit" '
24 git --git-dir=dest config receive.unpacklimit "$unpack_limit"
27 test_expect_success
'setting receive.maxInputSize to 512 rejects push' '
28 git --git-dir=dest config receive.maxInputSize 512 &&
29 test_must_fail git push dest HEAD
32 test_expect_success
'bumping limit to 4k allows push' '
33 git --git-dir=dest config receive.maxInputSize 4k &&
37 test_expect_success
'prepare destination repository (again)' '
42 test_expect_success
'lifting the limit allows push' '
43 git --git-dir=dest config receive.maxInputSize 0 &&
48 test_expect_success
"create known-size (1024 bytes) commit" '
49 test-tool genrandom foo 1024 >one-k &&
54 test_pack_input_limit index
55 test_pack_input_limit unpack