]>
Commit | Line | Data |
---|---|---|
4c324c00 JS |
1 | #!/bin/sh |
2 | ||
3 | test_description='errors in upload-pack' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
7 | D=`pwd` | |
8 | ||
9 | corrupt_repo () { | |
10 | object_sha1=$(git rev-parse "$1") && | |
11 | ob=$(expr "$object_sha1" : "\(..\)") && | |
12 | ject=$(expr "$object_sha1" : "..\(..*\)") && | |
13 | rm -f ".git/objects/$ob/$ject" | |
14 | } | |
15 | ||
16 | test_expect_success 'setup and corrupt repository' ' | |
17 | ||
18 | echo file >file && | |
19 | git add file && | |
20 | git rev-parse :file && | |
21 | git commit -a -m original && | |
22 | test_tick && | |
23 | echo changed >file && | |
24 | git commit -a -m changed && | |
25 | corrupt_repo HEAD:file | |
26 | ||
27 | ' | |
28 | ||
41ac414e JH |
29 | test_expect_success 'fsck fails' ' |
30 | ! git fsck | |
4c324c00 JS |
31 | ' |
32 | ||
33 | test_expect_success 'upload-pack fails due to error in pack-objects' ' | |
34 | ||
35 | ! echo "0032want $(git rev-parse HEAD) | |
36 | 00000009done | |
37 | 0000" | git-upload-pack . > /dev/null 2> output.err && | |
38 | grep "pack-objects died" output.err | |
39 | ' | |
40 | ||
41 | test_expect_success 'corrupt repo differently' ' | |
42 | ||
43 | git hash-object -w file && | |
44 | corrupt_repo HEAD^^{tree} | |
45 | ||
46 | ' | |
47 | ||
41ac414e JH |
48 | test_expect_success 'fsck fails' ' |
49 | ! git fsck | |
4c324c00 JS |
50 | ' |
51 | test_expect_success 'upload-pack fails due to error in rev-list' ' | |
52 | ||
53 | ! echo "0032want $(git rev-parse HEAD) | |
54 | 00000009done | |
55 | 0000" | git-upload-pack . > /dev/null 2> output.err && | |
56 | grep "waitpid (async) failed" output.err | |
57 | ' | |
58 | ||
59 | test_expect_success 'create empty repository' ' | |
60 | ||
61 | mkdir foo && | |
62 | cd foo && | |
63 | git init | |
64 | ||
65 | ' | |
66 | ||
41ac414e | 67 | test_expect_success 'fetch fails' ' |
4c324c00 | 68 | |
41ac414e | 69 | ! git fetch .. master |
4c324c00 JS |
70 | |
71 | ' | |
72 | ||
73 | test_done |