]>
Commit | Line | Data |
---|---|---|
4845b772 JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test responses to violations of the network protocol. In most | |
4 | of these cases it will generally be acceptable for one side to break off | |
5 | communications if the other side says something unexpected. We are mostly | |
6 | making sure that we do not segfault or otherwise behave badly.' | |
d96fb140 ÆAB |
7 | |
8 | TEST_PASSES_SANITIZE_LEAK=true | |
4845b772 JK |
9 | . ./test-lib.sh |
10 | ||
11 | test_expect_success 'extra delim packet in v2 ls-refs args' ' | |
12 | { | |
13 | packetize command=ls-refs && | |
4ddd3f50 | 14 | packetize "object-format=$(test_oid algo)" && |
4845b772 JK |
15 | printf 0001 && |
16 | # protocol expects 0000 flush here | |
17 | printf 0001 | |
18 | } >input && | |
19 | test_must_fail env GIT_PROTOCOL=version=2 \ | |
20 | git upload-pack . <input 2>err && | |
6789275d | 21 | test_grep "expected flush after ls-refs arguments" err |
4845b772 JK |
22 | ' |
23 | ||
24 | test_expect_success 'extra delim packet in v2 fetch args' ' | |
25 | { | |
26 | packetize command=fetch && | |
4ddd3f50 | 27 | packetize "object-format=$(test_oid algo)" && |
4845b772 JK |
28 | printf 0001 && |
29 | # protocol expects 0000 flush here | |
30 | printf 0001 | |
31 | } >input && | |
32 | test_must_fail env GIT_PROTOCOL=version=2 \ | |
33 | git upload-pack . <input 2>err && | |
6789275d | 34 | test_grep "expected flush after fetch arguments" err |
4845b772 JK |
35 | ' |
36 | ||
44d2aec6 AH |
37 | test_expect_success 'bogus symref in v0 capabilities' ' |
38 | test_commit foo && | |
39 | oid=$(git rev-parse HEAD) && | |
40 | dst=refs/heads/foo && | |
41 | { | |
42 | printf "%s HEAD\0symref object-format=%s symref=HEAD:%s\n" \ | |
43 | "$oid" "$GIT_DEFAULT_HASH" "$dst" | | |
44 | test-tool pkt-line pack-raw-stdin && | |
45 | printf "0000" | |
46 | } >input && | |
47 | git ls-remote --symref --upload-pack="cat input; read junk;:" . >actual && | |
48 | printf "ref: %s\tHEAD\n%s\tHEAD\n" "$dst" "$oid" >expect && | |
49 | test_cmp expect actual | |
50 | ' | |
51 | ||
4845b772 | 52 | test_done |