packv4: nth_packed_object_sha1() packv4 support
[git/packv4.git] / t / t5502-quickfetch.sh
blobb4760f2dc0bb690429b358cefde911db1fb26e9a
1 #!/bin/sh
3 test_description='test quickfetch from local'
5 . ./test-lib.sh
7 test_expect_success setup '
9 test_tick &&
10 echo ichi >file &&
11 git add file &&
12 git commit -m initial &&
14 cnt=$( (
15 git count-objects | sed -e "s/ *objects,.*//"
16 ) ) &&
17 test $cnt -eq 3
20 test_expect_success 'clone without alternate' '
23 mkdir cloned &&
24 cd cloned &&
25 git init-db &&
26 git remote add -f origin ..
27 ) &&
28 cnt=$( (
29 cd cloned &&
30 git count-objects | sed -e "s/ *objects,.*//"
31 ) ) &&
32 test $cnt -eq 3
35 test_expect_success 'further commits in the original' '
37 test_tick &&
38 echo ni >file &&
39 git commit -a -m second &&
41 cnt=$( (
42 git count-objects | sed -e "s/ *objects,.*//"
43 ) ) &&
44 test $cnt -eq 6
47 test_expect_success 'copy commit and tree but not blob by hand' '
49 git rev-list --objects HEAD |
50 git pack-objects --stdout |
52 cd cloned &&
53 git unpack-objects
54 ) &&
56 cnt=$( (
57 cd cloned &&
58 git count-objects | sed -e "s/ *objects,.*//"
59 ) ) &&
60 test $cnt -eq 6
62 blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
63 test -f "cloned/.git/objects/$blob" &&
64 rm -f "cloned/.git/objects/$blob" &&
66 cnt=$( (
67 cd cloned &&
68 git count-objects | sed -e "s/ *objects,.*//"
69 ) ) &&
70 test $cnt -eq 5
74 test_expect_success 'quickfetch should not leave a corrupted repository' '
77 cd cloned &&
78 git fetch
79 ) &&
81 cnt=$( (
82 cd cloned &&
83 git count-objects | sed -e "s/ *objects,.*//"
84 ) ) &&
85 test $cnt -eq 6
89 test_done