t5537: move http tests out to t5539
start_httpd is supposed to be at the beginning of the test file, not the middle of it. The "test_seq" line in "no shallow lines.." test is updated to compensate missing refs that are there in t5537, but not in the new t5539. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Feb 13, 2014 at 20:21 UTC
0232852b06cb000a3b1f5f48676c8b4d084f18ea
2 files changed
+82
-57
t/t5537-fetch-shallow.sh
-57
@@ -173,61 +173,4 @@ EOF
173
)
174
'
175
176
-if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
177
- say 'skipping remaining tests, git built without http support'
178
- test_done
179
-fi
180
-
181
-. "$TEST_DIRECTORY"/lib-httpd.sh
182
-start_httpd
183
-
184
-test_expect_success 'clone http repository' '
185
- git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
186
- git clone $HTTPD_URL/smart/repo.git clone &&
187
- (
188
- cd clone &&
189
- git fsck &&
190
- git log --format=%s origin/master >actual &&
191
- cat <<EOF >expect &&
192
-7
193
-6
194
-5
195
-4
196
-3
197
-EOF
198
- test_cmp expect actual
199
- )
200
-'
201
-
202
-# This test is tricky. We need large enough "have"s that fetch-pack
203
-# will put pkt-flush in between. Then we need a "have" the server
204
-# does not have, it'll send "ACK %s ready"
205
-test_expect_success 'no shallow lines after receiving ACK ready' '
206
- (
207
- cd shallow &&
208
- for i in $(test_seq 10)
209
- do
210
- git checkout --orphan unrelated$i &&
211
- test_commit unrelated$i &&
212
- git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
213
- refs/heads/unrelated$i:refs/heads/unrelated$i &&
214
- git push -q ../clone/.git \
215
- refs/heads/unrelated$i:refs/heads/unrelated$i ||
216
- exit 1
217
- done &&
218
- git checkout master &&
219
- test_commit new &&
220
- git push "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
221
- ) &&
222
- (
223
- cd clone &&
224
- git checkout --orphan newnew &&
225
- test_commit new-too &&
226
- GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 &&
227
- grep "fetch-pack< ACK .* ready" ../trace &&
228
- ! grep "fetch-pack> done" ../trace
229
- )
230
-'
231
-
232
-stop_httpd
176
test_done
t/t5539-fetch-http-shallow.sh
new
+82
@@ -0,0 +1,82 @@
1
+#!/bin/sh
2
+
3
+test_description='fetch/clone from a shallow clone over http'
4
+
5
+. ./test-lib.sh
6
+
7
+if test -n "$NO_CURL"; then
8
+ skip_all='skipping test, git built without http support'
9
+ test_done
10
+fi
11
+
12
+. "$TEST_DIRECTORY"/lib-httpd.sh
13
+start_httpd
14
+
15
+commit() {
16
+ echo "$1" >tracked &&
17
+ git add tracked &&
18
+ git commit -m "$1"
19
+}
20
+
21
+test_expect_success 'setup shallow clone' '
22
+ commit 1 &&
23
+ commit 2 &&
24
+ commit 3 &&
25
+ commit 4 &&
26
+ commit 5 &&
27
+ commit 6 &&
28
+ commit 7 &&
29
+ git clone --no-local --depth=5 .git shallow &&
30
+ git config --global transfer.fsckObjects true
31
+'
32
+
33
+test_expect_success 'clone http repository' '
34
+ git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
35
+ git clone $HTTPD_URL/smart/repo.git clone &&
36
+ (
37
+ cd clone &&
38
+ git fsck &&
39
+ git log --format=%s origin/master >actual &&
40
+ cat <<EOF >expect &&
41
+7
42
+6
43
+5
44
+4
45
+3
46
+EOF
47
+ test_cmp expect actual
48
+ )
49
+'
50
+
51
+# This test is tricky. We need large enough "have"s that fetch-pack
52
+# will put pkt-flush in between. Then we need a "have" the server
53
+# does not have, it'll send "ACK %s ready"
54
+test_expect_success 'no shallow lines after receiving ACK ready' '
55
+ (
56
+ cd shallow &&
57
+ for i in $(test_seq 15)
58
+ do
59
+ git checkout --orphan unrelated$i &&
60
+ test_commit unrelated$i &&
61
+ git push -q "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" \
62
+ refs/heads/unrelated$i:refs/heads/unrelated$i &&
63
+ git push -q ../clone/.git \
64
+ refs/heads/unrelated$i:refs/heads/unrelated$i ||
65
+ exit 1
66
+ done &&
67
+ git checkout master &&
68
+ test_commit new &&
69
+ git push "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" master
70
+ ) &&
71
+ (
72
+ cd clone &&
73
+ git checkout --orphan newnew &&
74
+ test_commit new-too &&
75
+ GIT_TRACE_PACKET="$TRASH_DIRECTORY/trace" git fetch --depth=2 &&
76
+ grep "fetch-pack< ACK .* ready" ../trace &&
77
+ ! grep "fetch-pack> done" ../trace
78
+ )
79
+'
80
+
81
+stop_httpd
82
+test_done