3 test_description
='errors in upload-pack'
10 object_sha1
=$
(git rev-parse
"$1") &&
11 ob
=$
(expr "$object_sha1" : "\(..\)") &&
12 ject
=$
(expr "$object_sha1" : "..\(..*\)") &&
13 rm -f ".git/objects/$ob/$ject"
16 test_expect_success
'setup and corrupt repository' '
20 git rev-parse :file &&
21 git commit -a -m original &&
24 git commit -a -m changed &&
25 corrupt_repo HEAD:file
29 test_expect_success
'fsck fails' '
30 test_must_fail git fsck
33 test_expect_success
'upload-pack fails due to error in pack-objects packing' '
35 ! echo "0032want $(git rev-parse HEAD)
37 0000" | git upload-pack . > /dev/null 2> output.err &&
38 grep "unable to read" output.err &&
39 grep "pack-objects died" output.err
42 test_expect_success
'corrupt repo differently' '
44 git hash-object -w file &&
45 corrupt_repo HEAD^^{tree}
49 test_expect_success
'fsck fails' '
50 test_must_fail git fsck
52 test_expect_success
'upload-pack fails due to error in rev-list' '
54 ! echo "0032want $(git rev-parse HEAD)
55 0034shallow $(git rev-parse HEAD^)00000009done
56 0000" | git upload-pack . > /dev/null 2> output.err &&
57 grep "waitpid (async) failed" output.err
60 test_expect_success
'upload-pack fails due to error in pack-objects enumeration' '
62 ! echo "0032want $(git rev-parse HEAD)
64 0000" | git upload-pack . > /dev/null 2> output.err &&
65 grep "bad tree object" output.err &&
66 grep "pack-objects died" output.err
69 test_expect_success
'create empty repository' '
77 test_expect_success
'fetch fails' '
79 test_must_fail git fetch .. master