Skip to content

Commit 9901164

Browse files
jiangxingitster
authored andcommitted
test: add helper functions for git-bundle
Move git-bundle related functions from t5510 to a library, and this lib will be shared with a new testcase t6020 which finds a known breakage of "git-bundle". Signed-off-by: Jiang Xin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 72c4083 commit 9901164

File tree

3 files changed

+440
-22
lines changed

3 files changed

+440
-22
lines changed

t/t5510-fetch.sh

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@ test_description='Per branch config variables affects "git fetch".
66
'
77

88
. ./test-lib.sh
9+
. "$TEST_DIRECTORY"/test-bundle-functions.sh
910

1011
D=$(pwd)
1112

12-
test_bundle_object_count () {
13-
git verify-pack -v "$1" >verify.out &&
14-
test "$2" = $(grep "^$OID_REGEX " verify.out | wc -l)
15-
}
16-
17-
convert_bundle_to_pack () {
18-
while read x && test -n "$x"
19-
do
20-
:;
21-
done
22-
cat
23-
}
24-
2513
test_expect_success setup '
2614
echo >file original &&
2715
git add file &&
@@ -312,9 +300,7 @@ test_expect_success 'unbundle 1' '
312300

313301
test_expect_success 'bundle 1 has only 3 files ' '
314302
cd "$D" &&
315-
convert_bundle_to_pack <bundle1 >bundle.pack &&
316-
git index-pack bundle.pack &&
317-
test_bundle_object_count bundle.pack 3
303+
test_bundle_object_count bundle1 3
318304
'
319305

320306
test_expect_success 'unbundle 2' '
@@ -329,9 +315,7 @@ test_expect_success 'bundle does not prerequisite objects' '
329315
git add file2 &&
330316
git commit -m add.file2 file2 &&
331317
git bundle create bundle3 -1 HEAD &&
332-
convert_bundle_to_pack <bundle3 >bundle.pack &&
333-
git index-pack bundle.pack &&
334-
test_bundle_object_count bundle.pack 3
318+
test_bundle_object_count bundle3 3
335319
'
336320

337321
test_expect_success 'bundle should be able to create a full history' '
@@ -884,9 +868,7 @@ test_expect_success 'all boundary commits are excluded' '
884868
git merge otherside &&
885869
ad=$(git log --no-walk --format=%ad HEAD) &&
886870
git bundle create twoside-boundary.bdl main --since="$ad" &&
887-
convert_bundle_to_pack <twoside-boundary.bdl >twoside-boundary.pack &&
888-
pack=$(git index-pack --fix-thin --stdin <twoside-boundary.pack) &&
889-
test_bundle_object_count .git/objects/pack/pack-${pack##pack }.pack 3
871+
test_bundle_object_count --thin twoside-boundary.bdl 3
890872
'
891873

892874
test_expect_success 'fetch --prune prints the remotes url' '

0 commit comments

Comments
 (0)