Skip to content

Commit 2e674a9

Browse files
committed
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 <[email protected]>
1 parent d4900ee commit 2e674a9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

t/t5510-fetch.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ test_description='Per branch config variables affects "git fetch".
99

1010
D=`pwd`
1111

12+
test_bundle_object_count () {
13+
git verify-pack -v "$1" >verify.out &&
14+
test "$2" = $(grep '^[0-9a-f]\{40\} ' verify.out | wc -l)
15+
}
16+
1217
test_expect_success setup '
1318
echo >file original &&
1419
git add file &&
@@ -146,6 +151,7 @@ test_expect_success 'unbundle 1' '
146151
test_must_fail git fetch "$D/bundle1" master:master
147152
'
148153

154+
149155
test_expect_success 'bundle 1 has only 3 files ' '
150156
cd "$D" &&
151157
(
@@ -156,8 +162,7 @@ test_expect_success 'bundle 1 has only 3 files ' '
156162
cat
157163
) <bundle1 >bundle.pack &&
158164
git index-pack bundle.pack &&
159-
verify=$(git verify-pack -v bundle.pack) &&
160-
test 4 = $(echo "$verify" | wc -l)
165+
test_bundle_object_count bundle.pack 3
161166
'
162167

163168
test_expect_success 'unbundle 2' '
@@ -180,7 +185,7 @@ test_expect_success 'bundle does not prerequisite objects' '
180185
cat
181186
) <bundle3 >bundle.pack &&
182187
git index-pack bundle.pack &&
183-
test 4 = $(git verify-pack -v bundle.pack | wc -l)
188+
test_bundle_object_count bundle.pack 3
184189
'
185190

186191
test_expect_success 'bundle should be able to create a full history' '

0 commit comments

Comments
 (0)