3 test_description
='test quickfetch from local'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
10 test_expect_success setup
'
15 git commit -m initial &&
18 git count-objects | sed -e "s/ *objects,.*//"
23 test_expect_success
'clone without alternate' '
29 git remote add -f origin ..
33 git count-objects | sed -e "s/ *objects,.*//"
38 test_expect_success
'further commits in the original' '
42 git commit -a -m second &&
45 git count-objects | sed -e "s/ *objects,.*//"
50 test_expect_success
'copy commit and tree but not blob by hand' '
52 git rev-list --objects HEAD |
53 git pack-objects --stdout |
61 git count-objects | sed -e "s/ *objects,.*//"
65 blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
66 test -f "cloned/.git/objects/$blob" &&
67 rm -f "cloned/.git/objects/$blob" &&
71 git count-objects | sed -e "s/ *objects,.*//"
77 test_expect_success
'quickfetch should not leave a corrupted repository' '
86 git count-objects | sed -e "s/ *objects,.*//"
92 test_expect_success
'quickfetch should not copy from alternate' '
98 (cd ../.git/objects && pwd) >.git/objects/info/alternates &&
99 git remote add origin .. &&
104 git count-objects | sed -e "s/ *objects,.*//"
108 git count-objects -v | sed -n -e "/packs:/{
116 git rev-parse origin/main
118 echo "loose objects: $obj_cnt, packfiles: $pck_cnt" &&
119 test $obj_cnt -eq 0 &&
120 test $pck_cnt -eq 0 &&
121 test z$origin_main = z$(git rev-parse main)
125 test_expect_success
'quickfetch should handle ~1000 refs (on Windows)' '
128 head=$(git rev-parse HEAD) &&
129 branchprefix="$head refs/heads/branch" &&
130 for i in 0 1 2 3 4 5 6 7 8 9; do
131 for j in 0 1 2 3 4 5 6 7 8 9; do
132 for k in 0 1 2 3 4 5 6 7 8 9; do
133 echo "$branchprefix$i$j$k" >> .git/packed-refs