3 test_description='check receive input limits'
6 # Let's run tests with different unpack limits: 1 and 10000
7 # When the limit is 1, `git receive-pack` will call `git index-pack`.
8 # When the limit is 10000, `git receive-pack` will call `git unpack-objects`.
10 test_pack_input_limit () {
12 index) unpack_limit=1 ;;
13 unpack) unpack_limit=10000 ;;
16 test_expect_success 'prepare destination repository' '
21 test_expect_success "set unpacklimit to $unpack_limit" '
22 git --git-dir=dest config receive.unpacklimit "$unpack_limit"
25 test_expect_success 'setting receive.maxInputSize to 512 rejects push' '
26 git --git-dir=dest config receive.maxInputSize 512 &&
27 test_must_fail git push dest HEAD
30 test_expect_success 'bumping limit to 4k allows push' '
31 git --git-dir=dest config receive.maxInputSize 4k &&
35 test_expect_success 'prepare destination repository (again)' '
40 test_expect_success 'lifting the limit allows push' '
41 git --git-dir=dest config receive.maxInputSize 0 &&
46 test_expect_success "create known-size (1024 bytes) commit" '
47 test-genrandom foo 1024 >one-k &&
52 test_pack_input_limit index
53 test_pack_input_limit unpack