git-commit: squelch needless message during an empty merge
[git/git-p4.git] / t / t5530-upload-pack-error.sh
blobcc8949e3eff7b8d7802c5cdea5eddc7c2f1f9a53
1 #!/bin/sh
3 test_description='errors in upload-pack'
5 . ./test-lib.sh
7 D=`pwd`
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"
16 test_expect_success 'setup and corrupt repository' '
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
29 test_expect_failure 'fsck fails' '
31 git fsck
34 test_expect_success 'upload-pack fails due to error in pack-objects' '
36 ! echo "0032want $(git rev-parse HEAD)
37 00000009done
38 0000" | git-upload-pack . > /dev/null 2> 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_failure 'fsck fails' '
51 git fsck
53 test_expect_success 'upload-pack fails due to error in rev-list' '
55 ! echo "0032want $(git rev-parse HEAD)
56 00000009done
57 0000" | git-upload-pack . > /dev/null 2> output.err &&
58 grep "waitpid (async) failed" output.err
61 test_expect_success 'create empty repository' '
63 mkdir foo &&
64 cd foo &&
65 git init
69 test_expect_failure 'fetch fails' '
71 git fetch .. master
75 test_done