Use the final_oid_fn to finalize hashing of object IDs
[alt-git.git] / t / t5546-receive-limits.sh
blob0b0e987fdb73fcd7d8f54c393ee7deb15a4b5b8c
1 #!/bin/sh
3 test_description='check receive input limits'
4 . ./test-lib.sh
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 () {
11 case "$1" in
12 index) unpack_limit=1 ;;
13 unpack) unpack_limit=10000 ;;
14 esac
16 test_expect_success 'prepare destination repository' '
17 rm -fr dest &&
18 git --bare init dest
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 &&
32 git push dest HEAD
35 test_expect_success 'prepare destination repository (again)' '
36 rm -fr dest &&
37 git --bare init dest
40 test_expect_success 'lifting the limit allows push' '
41 git --git-dir=dest config receive.maxInputSize 0 &&
42 git push dest HEAD
46 test_expect_success "create known-size (1024 bytes) commit" '
47 test-tool genrandom foo 1024 >one-k &&
48 git add one-k &&
49 test_commit one-k
52 test_pack_input_limit index
53 test_pack_input_limit unpack
55 test_done