t5510: harden the way verify-pack is used

The test ignored the exit status from verify pack command, and also relied
on not seeing any delta chain statistics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2009-08-07 20:12:13 -07:00
parent d4900ee48c
commit 2e674a9d09

View File

@ -9,6 +9,11 @@ test_description='Per branch config variables affects "git fetch".
D=`pwd` D=`pwd`
test_bundle_object_count () {
git verify-pack -v "$1" >verify.out &&
test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
}
test_expect_success setup ' test_expect_success setup '
echo >file original && echo >file original &&
git add file && git add file &&
@ -146,6 +151,7 @@ test_expect_success 'unbundle 1' '
test_must_fail git fetch "$D/bundle1" master:master test_must_fail git fetch "$D/bundle1" master:master
' '
test_expect_success 'bundle 1 has only 3 files ' ' test_expect_success 'bundle 1 has only 3 files ' '
cd "$D" && cd "$D" &&
( (
@ -156,8 +162,7 @@ test_expect_success 'bundle 1 has only 3 files ' '
cat cat
) <bundle1 >bundle.pack && ) <bundle1 >bundle.pack &&
git index-pack bundle.pack && git index-pack bundle.pack &&
verify=$(git verify-pack -v bundle.pack) && test_bundle_object_count bundle.pack 3
test 4 = $(echo "$verify" | wc -l)
' '
test_expect_success 'unbundle 2' ' test_expect_success 'unbundle 2' '
@ -180,7 +185,7 @@ test_expect_success 'bundle does not prerequisite objects' '
cat cat
) <bundle3 >bundle.pack && ) <bundle3 >bundle.pack &&
git index-pack bundle.pack && git index-pack bundle.pack &&
test 4 = $(git verify-pack -v bundle.pack | wc -l) test_bundle_object_count bundle.pack 3
' '
test_expect_success 'bundle should be able to create a full history' ' test_expect_success 'bundle should be able to create a full history' '