decorate: add clear_decoration() function
[git.git] / t / t5546-receive-limits.sh
blobeed3c9d81abaffa8886b44f26224111b369735ce
1 #!/bin/sh
3 test_description='check receive input limits'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
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 () {
13 case "$1" in
14 index) unpack_limit=1 ;;
15 unpack) unpack_limit=10000 ;;
16 esac
18 test_expect_success 'prepare destination repository' '
19 rm -fr dest &&
20 git --bare init dest
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 &&
34 git push dest HEAD
37 test_expect_success 'prepare destination repository (again)' '
38 rm -fr dest &&
39 git --bare init dest
42 test_expect_success 'lifting the limit allows push' '
43 git --git-dir=dest config receive.maxInputSize 0 &&
44 git push dest HEAD
48 test_expect_success "create known-size (1024 bytes) commit" '
49 test-tool genrandom foo 1024 >one-k &&
50 git add one-k &&
51 test_commit one-k
54 test_pack_input_limit index
55 test_pack_input_limit unpack
57 test_done