1#!/bin/sh
23
test_description='test git wire-protocol version 2'
45
TEST_NO_CREATE_REPO=1
67
. ./test-lib.sh
89
# Test protocol v2 with 'git://' transport
10#
11. "$TEST_DIRECTORY"/lib-git-daemon.sh
12start_git_daemon --export-all --enable=receive-pack
13daemon_parent=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
1415
test_expect_success 'create repo to be served by git-daemon' '
16git init "$daemon_parent" &&
17test_commit -C "$daemon_parent" one
18'
1920
test_expect_success 'list refs with git:// using protocol v2' '
21test_when_finished "rm -f log" &&
2223
GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
24ls-remote --symref "$GIT_DAEMON_URL/parent" >actual &&
2526
# Client requested to use protocol v2
27grep "git> .*\\\0\\\0version=2\\\0$" log &&
28# Server responded using protocol v2
29grep "git< version 2" log &&
3031
git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
32test_cmp actual expect
33'
3435
stop_git_daemon
3637
# Test protocol v2 with 'file://' transport
38#
39test_expect_success 'create repo to be served by file:// transport' '
40git init file_parent &&
41test_commit -C file_parent one
42'
4344
test_expect_success 'list refs with file:// using protocol v2' '
45test_when_finished "rm -f log" &&
4647
GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
48ls-remote --symref "file://$(pwd)/file_parent" >actual &&
4950
# Server responded using protocol v2
51grep "git< version 2" log &&
5253
git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
54test_cmp actual expect
55'
5657
test_done