Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / git / t / t5502-quickfetch.sh
blob07978a5d2f5d2adc20b8c57ccbf5d607a3c5a817
1 #!/bin/sh
3 test_description='test quickfetch from local'
5 . ./test-lib.sh
7 say "git remote does not work in the test suite. Skipping tests."
8 test_done
10 test_expect_success setup '
12 test_tick &&
13 echo ichi >file &&
14 git add file &&
15 git commit -m initial &&
17 cnt=$( (
18 git count-objects | sed -e "s/ *objects,.*//"
19 ) ) &&
20 test $cnt -eq 3
23 test_expect_success 'clone without alternate' '
26 mkdir cloned &&
27 cd cloned &&
28 git init-db &&
29 git remote add -f origin ..
30 ) &&
31 cnt=$( (
32 cd cloned &&
33 git count-objects | sed -e "s/ *objects,.*//"
34 ) ) &&
35 test $cnt -eq 3
38 test_expect_success 'further commits in the original' '
40 test_tick &&
41 echo ni >file &&
42 git commit -a -m second &&
44 cnt=$( (
45 git count-objects | sed -e "s/ *objects,.*//"
46 ) ) &&
47 test $cnt -eq 6
50 test_expect_success 'copy commit and tree but not blob by hand' '
52 git rev-list --objects HEAD |
53 git pack-objects --stdout |
55 cd cloned &&
56 git unpack-objects
57 ) &&
59 cnt=$( (
60 cd cloned &&
61 git count-objects | sed -e "s/ *objects,.*//"
62 ) ) &&
63 test $cnt -eq 6
65 blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") &&
66 test -f "cloned/.git/objects/$blob" &&
67 rm -f "cloned/.git/objects/$blob" &&
69 cnt=$( (
70 cd cloned &&
71 git count-objects | sed -e "s/ *objects,.*//"
72 ) ) &&
73 test $cnt -eq 5
77 test_expect_success 'quickfetch should not leave a corrupted repository' '
80 cd cloned &&
81 git fetch
82 ) &&
84 cnt=$( (
85 cd cloned &&
86 git count-objects | sed -e "s/ *objects,.*//"
87 ) ) &&
88 test $cnt -eq 6
92 test_done