]>
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.' | |
7 | . ./test-lib.sh | |
8 | ||
9 | test_expect_success 'extra delim packet in v2 ls-refs args' ' | |
10 | { | |
11 | packetize command=ls-refs && | |
4ddd3f50 | 12 | packetize "object-format=$(test_oid algo)" && |
4845b772 JK |
13 | printf 0001 && |
14 | # protocol expects 0000 flush here | |
15 | printf 0001 | |
16 | } >input && | |
17 | test_must_fail env GIT_PROTOCOL=version=2 \ | |
18 | git upload-pack . <input 2>err && | |
19 | test_i18ngrep "expected flush after ls-refs arguments" err | |
20 | ' | |
21 | ||
22 | test_expect_success 'extra delim packet in v2 fetch args' ' | |
23 | { | |
24 | packetize command=fetch && | |
4ddd3f50 | 25 | packetize "object-format=$(test_oid algo)" && |
4845b772 JK |
26 | printf 0001 && |
27 | # protocol expects 0000 flush here | |
28 | printf 0001 | |
29 | } >input && | |
30 | test_must_fail env GIT_PROTOCOL=version=2 \ | |
31 | git upload-pack . <input 2>err && | |
32 | test_i18ngrep "expected flush after fetch arguments" err | |
33 | ' | |
34 | ||
44d2aec6 AH |
35 | test_expect_success 'bogus symref in v0 capabilities' ' |
36 | test_commit foo && | |
37 | oid=$(git rev-parse HEAD) && | |
38 | dst=refs/heads/foo && | |
39 | { | |
40 | printf "%s HEAD\0symref object-format=%s symref=HEAD:%s\n" \ | |
41 | "$oid" "$GIT_DEFAULT_HASH" "$dst" | | |
42 | test-tool pkt-line pack-raw-stdin && | |
43 | printf "0000" | |
44 | } >input && | |
45 | git ls-remote --symref --upload-pack="cat input; read junk;:" . >actual && | |
46 | printf "ref: %s\tHEAD\n%s\tHEAD\n" "$dst" "$oid" >expect && | |
47 | test_cmp expect actual | |
48 | ' | |
49 | ||
4845b772 | 50 | test_done |