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 validate_store_type
() {
13 git
-C dest count-objects
-v >actual
&&
16 grep "^count: 0$" actual
;;
18 grep "^packs: 0$" actual
;;
20 echo "store_type is $store_type"
26 test_pack_input_limit
() {
30 index
) unpack_limit
=1 other_limit
=10000 ;;
31 unpack
) unpack_limit
=10000 other_limit
=1 ;;
34 test_expect_success
'prepare destination repository' '
39 test_expect_success
"set unpacklimit to $unpack_limit" '
40 git --git-dir=dest config receive.unpacklimit "$unpack_limit"
43 test_expect_success
'setting receive.maxInputSize to 512 rejects push' '
44 git --git-dir=dest config receive.maxInputSize 512 &&
45 test_must_fail git push dest HEAD
48 test_expect_success
'bumping limit to 4k allows push' '
49 git --git-dir=dest config receive.maxInputSize 4k &&
53 test_expect_success
'prepare destination repository (again)' '
58 test_expect_success
'lifting the limit allows push' '
59 git --git-dir=dest config receive.maxInputSize 0 &&
63 test_expect_success
'prepare destination repository (once more)' '
68 test_expect_success
'receive trumps transfer' '
69 git --git-dir=dest config receive.unpacklimit "$unpack_limit" &&
70 git --git-dir=dest config transfer.unpacklimit "$other_limit" &&
77 test_expect_success
"create known-size (1024 bytes) commit" '
78 test-tool genrandom foo 1024 >one-k &&
83 test_pack_input_limit index
84 test_pack_input_limit unpack