Skip to content

Commit afa53fe

Browse files
nickalcockgitster
authored andcommitted
t5538: move http push tests out to t5542
As 0232852, but for the push tests instead: this avoids a start_httpd in the middle of the file, which fails under GIT_TEST_HTTPD=false. Note that we have to munge the test in a few ways while moving it: 1. We drop the `test -z "$GIT_TEST_HTTPD"` check; this is too simplistic since 83d842d, and we should let lib-httpd.sh handle it. 2. We have to port over some of the old setup from t5538. 3. In the final test, we no longer expect the extra commit "1" built on top of "4". This was a side effect from an earlier test in t5538 which was not ported over. Signed-off-by: Nick Alcock <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0232852 commit afa53fe

File tree

2 files changed

+100
-59
lines changed

2 files changed

+100
-59
lines changed

t/t5538-push-shallow.sh

-59
Original file line numberDiff line numberDiff line change
@@ -120,63 +120,4 @@ EOF
120120
git cat-file blob `echo 1|git hash-object --stdin` >/dev/null
121121
)
122122
'
123-
124-
if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
125-
say 'skipping remaining tests, git built without http support'
126-
test_done
127-
fi
128-
129-
. "$TEST_DIRECTORY"/lib-httpd.sh
130-
start_httpd
131-
132-
test_expect_success 'push to shallow repo via http' '
133-
git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
134-
(
135-
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
136-
git config http.receivepack true
137-
) &&
138-
(
139-
cd full &&
140-
commit 9 &&
141-
git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
142-
) &&
143-
(
144-
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
145-
git fsck &&
146-
git log --format=%s top/master >actual &&
147-
cat <<EOF >expect &&
148-
9
149-
4
150-
3
151-
EOF
152-
test_cmp expect actual
153-
)
154-
'
155-
156-
test_expect_success 'push from shallow repo via http' '
157-
mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
158-
git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
159-
(
160-
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
161-
git config http.receivepack true
162-
) &&
163-
commit 10 &&
164-
git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
165-
(
166-
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
167-
git fsck &&
168-
git log --format=%s top/master >actual &&
169-
cat <<EOF >expect &&
170-
10
171-
1
172-
4
173-
3
174-
2
175-
1
176-
EOF
177-
test_cmp expect actual
178-
)
179-
'
180-
181-
stop_httpd
182123
test_done

t/t5542-push-http-shallow.sh

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
#!/bin/sh
2+
3+
test_description='push from/to a shallow clone over http'
4+
5+
. ./test-lib.sh
6+
7+
if test -n "$NO_CURL"; then
8+
say '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' '
22+
git config --global transfer.fsckObjects true &&
23+
commit 1 &&
24+
commit 2 &&
25+
commit 3 &&
26+
commit 4 &&
27+
git clone . full &&
28+
(
29+
git init full-abc &&
30+
cd full-abc &&
31+
commit a &&
32+
commit b &&
33+
commit c
34+
) &&
35+
git clone --no-local --depth=2 .git shallow &&
36+
git --git-dir=shallow/.git log --format=%s >actual &&
37+
cat <<EOF >expect &&
38+
4
39+
3
40+
EOF
41+
test_cmp expect actual &&
42+
git clone --no-local --depth=2 full-abc/.git shallow2 &&
43+
git --git-dir=shallow2/.git log --format=%s >actual &&
44+
cat <<EOF >expect &&
45+
c
46+
b
47+
EOF
48+
test_cmp expect actual
49+
'
50+
51+
test_expect_success 'push to shallow repo via http' '
52+
git clone --bare --no-local shallow "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
53+
(
54+
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
55+
git config http.receivepack true
56+
) &&
57+
(
58+
cd full &&
59+
commit 9 &&
60+
git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master
61+
) &&
62+
(
63+
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
64+
git fsck &&
65+
git log --format=%s top/master >actual &&
66+
cat <<EOF >expect &&
67+
9
68+
4
69+
3
70+
EOF
71+
test_cmp expect actual
72+
)
73+
'
74+
75+
test_expect_success 'push from shallow repo via http' '
76+
mv "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" shallow-upstream.git &&
77+
git clone --bare --no-local full "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
78+
(
79+
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
80+
git config http.receivepack true
81+
) &&
82+
commit 10 &&
83+
git push $HTTPD_URL/smart/repo.git +master:refs/remotes/top/master &&
84+
(
85+
cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" &&
86+
git fsck &&
87+
git log --format=%s top/master >actual &&
88+
cat <<EOF >expect &&
89+
10
90+
4
91+
3
92+
2
93+
1
94+
EOF
95+
test_cmp expect actual
96+
)
97+
'
98+
99+
stop_httpd
100+
test_done

0 commit comments

Comments
 (0)