@@ -220,4 +220,73 @@ test_expect_success 'push with ssh:// using protocol v1' '
220220 grep "push< version 1" log
221221'
222222
223+ # Test protocol v1 with 'http://' transport
224+ #
225+ . " $TEST_DIRECTORY " /lib-httpd.sh
226+ start_httpd
227+
228+ test_expect_success ' create repo to be served by http:// transport' '
229+ git init "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" &&
230+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" config http.receivepack true &&
231+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" one
232+ '
233+
234+ test_expect_success ' clone with http:// using protocol v1' '
235+ GIT_TRACE_PACKET=1 GIT_TRACE_CURL=1 git -c protocol.version=1 \
236+ clone "$HTTPD_URL/smart/http_parent" http_child 2>log &&
237+
238+ git -C http_child log -1 --format=%s >actual &&
239+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
240+ test_cmp expect actual &&
241+
242+ # Client requested to use protocol v1
243+ grep "Git-Protocol: version=1" log &&
244+ # Server responded using protocol v1
245+ grep "git< version 1" log
246+ '
247+
248+ test_expect_success ' fetch with http:// using protocol v1' '
249+ test_commit -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" two &&
250+
251+ GIT_TRACE_PACKET=1 git -C http_child -c protocol.version=1 \
252+ fetch 2>log &&
253+
254+ git -C http_child log -1 --format=%s origin/master >actual &&
255+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
256+ test_cmp expect actual &&
257+
258+ # Server responded using protocol v1
259+ grep "git< version 1" log
260+ '
261+
262+ test_expect_success ' pull with http:// using protocol v1' '
263+ GIT_TRACE_PACKET=1 git -C http_child -c protocol.version=1 \
264+ pull 2>log &&
265+
266+ git -C http_child log -1 --format=%s >actual &&
267+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s >expect &&
268+ test_cmp expect actual &&
269+
270+ # Server responded using protocol v1
271+ grep "git< version 1" log
272+ '
273+
274+ test_expect_success ' push with http:// using protocol v1' '
275+ test_commit -C http_child three &&
276+
277+ # Push to another branch, as the target repository has the
278+ # master branch checked out and we cannot push into it.
279+ GIT_TRACE_PACKET=1 git -C http_child -c protocol.version=1 \
280+ push origin HEAD:client_branch && #2>log &&
281+
282+ git -C http_child log -1 --format=%s >actual &&
283+ git -C "$HTTPD_DOCUMENT_ROOT_PATH/http_parent" log -1 --format=%s client_branch >expect &&
284+ test_cmp expect actual &&
285+
286+ # Server responded using protocol v1
287+ grep "git< version 1" log
288+ '
289+
290+ stop_httpd
291+
223292test_done
0 commit comments