3 # Copyright (c) 2005 Johannes Schindelin
6 test_description
='Testing multi_ack pack fetching'
10 # Test fetch-pack/upload-pack pair.
12 # Some convenience functions
17 branch
=`echo $name | sed -e 's/^\(.\).*$/\1/'` &&
22 parents
="$parents -p $1" &&
26 echo "$text" > test.txt
&&
27 git update-index
--add test.txt
&&
28 tree
=$
(git write-tree
) &&
29 # make sure timestamps are in correct order
31 commit
=$
(echo "$text" | git commit-tree
$tree $parents) &&
32 eval "$name=$commit; export $name" &&
33 echo $commit > .git
/refs
/heads
/$branch &&
34 eval ${branch}TIP
=$commit
41 test_expect_success
"$number pull" '
44 git fetch-pack -k -v .. $heads &&
48 echo $ATIP > .git/refs/heads/A;;
51 echo $BTIP > .git/refs/heads/B;;
53 git symbolic-ref HEAD refs/heads/`echo $heads \
54 | sed -e "s/^\(.\).*$/\1/"` &&
58 mv .git/objects/pack/pack-* . &&
59 p=`ls -1 pack-*.pack` &&
60 git unpack-objects <$p &&
63 idx=`echo pack-*.idx` &&
64 pack_count=`git show-index <$idx | wc -l` &&
65 test $pack_count = $count &&
71 # Here begins the actual testing
73 # A1 - ... - A20 - A21
77 # client pulls A20, B1. Then tracks only B. Then pulls A.
79 test_expect_success
'setup' '
84 git config transfer.unpacklimit 0
89 while [ $cur -le 10 ]; do
90 add A$cur $(eval echo \$A$prev) &&
95 echo $ATIP > .git/refs/heads/A &&
96 echo $BTIP > .git/refs/heads/B &&
97 git symbolic-ref HEAD refs/heads/B
100 pull_to_client
1st
"refs/heads/B refs/heads/A" $
((11*3))
102 test_expect_success
'post 1st pull setup' '
106 while [ $cur -le 65 ]; do
107 add B$cur $(eval echo \$B$prev) &&
113 pull_to_client
2nd
"refs/heads/B" $
((64*3))
115 pull_to_client
3rd
"refs/heads/A" $
((1*3))
117 test_expect_success
'clone shallow' '
118 git clone --depth 2 "file://$(pwd)/." shallow
121 test_expect_success
'clone shallow object count' '
126 grep "^in-pack: 18" count.shallow
129 test_expect_success
'clone shallow object count (part 2)' '
130 sed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \
131 -e "/: 0$/d" count.shallow > count_output &&
132 ! test -s count_output
135 test_expect_success
'fsck in shallow repo' '
142 test_expect_success
'simple fetch in shallow repo' '
149 test_expect_success
'no changes expected' '
153 ) > count.shallow.2 &&
154 cmp count.shallow count.shallow.2
157 test_expect_success
'fetch same depth in shallow repo' '
164 test_expect_success
'no changes expected' '
168 ) > count.shallow.3 &&
169 cmp count.shallow count.shallow.3
172 test_expect_success
'add two more' '
177 test_expect_success
'pull in shallow repo' '
184 test_expect_success
'clone shallow object count' '
189 grep "^count: 6" count.shallow
192 test_expect_success
'add two more (part 2)' '
197 test_expect_success
'deepening pull in shallow repo' '
200 git pull --depth 4 .. B
204 test_expect_success
'clone shallow object count' '
209 grep "^count: 12" count.shallow
212 test_expect_success
'deepening fetch in shallow repo' '
215 git fetch --depth 4 .. A:A
219 test_expect_success
'clone shallow object count' '
224 grep "^count: 18" count.shallow
227 test_expect_success
'pull in shallow repo with missing merge base' '
230 test_must_fail git pull --depth 4 .. A
234 test_expect_success
'additional simple shallow deepenings' '
237 git fetch --depth=8 &&
238 git fetch --depth=10 &&
243 test_expect_success
'clone shallow object count' '
248 grep "^count: 52" count.shallow