diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-11-11 15:19:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-11 15:19:57 -0800 |
commit | 40e2524da9f9fb2806a66a694b9aee722ea3ef0a (patch) | |
tree | 36a6a6cdb3ea1755447e823b3d5f2e67e0655c87 /t | |
parent | 52b9b48a2c0cfd703cf95ae8b4913544c5497aba (diff) | |
parent | 4c324c00501c2da41987498f8c966b022306b244 (diff) | |
download | git-40e2524da9f9fb2806a66a694b9aee722ea3ef0a.tar.gz git-40e2524da9f9fb2806a66a694b9aee722ea3ef0a.tar.xz |
Merge branch 'js/upload-pack'
* js/upload-pack:
upload-pack: Use finish_{command,async}() instead of waitpid().
Diffstat (limited to 't')
-rwxr-xr-x | t/t5530-upload-pack-error.sh | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh new file mode 100755 index 000000000..cc8949e3e --- /dev/null +++ b/t/t5530-upload-pack-error.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +test_description='errors in upload-pack' + +. ./test-lib.sh + +D=`pwd` + +corrupt_repo () { + object_sha1=$(git rev-parse "$1") && + ob=$(expr "$object_sha1" : "\(..\)") && + ject=$(expr "$object_sha1" : "..\(..*\)") && + rm -f ".git/objects/$ob/$ject" +} + +test_expect_success 'setup and corrupt repository' ' + + echo file >file && + git add file && + git rev-parse :file && + git commit -a -m original && + test_tick && + echo changed >file && + git commit -a -m changed && + corrupt_repo HEAD:file + +' + +test_expect_failure 'fsck fails' ' + + git fsck +' + +test_expect_success 'upload-pack fails due to error in pack-objects' ' + + ! echo "0032want $(git rev-parse HEAD) +00000009done +0000" | git-upload-pack . > /dev/null 2> output.err && + grep "pack-objects died" output.err +' + +test_expect_success 'corrupt repo differently' ' + + git hash-object -w file && + corrupt_repo HEAD^^{tree} + +' + +test_expect_failure 'fsck fails' ' + + git fsck +' +test_expect_success 'upload-pack fails due to error in rev-list' ' + + ! echo "0032want $(git rev-parse HEAD) +00000009done +0000" | git-upload-pack . > /dev/null 2> output.err && + grep "waitpid (async) failed" output.err +' + +test_expect_success 'create empty repository' ' + + mkdir foo && + cd foo && + git init + +' + +test_expect_failure 'fetch fails' ' + + git fetch .. master + +' + +test_done |