]>
git.ipfire.org Git - thirdparty/git.git/blob - t/t5702-protocol-v2.sh
3 test_description
='test git wire-protocol version 2'
9 # Test protocol v2 with 'git://' transport
11 .
"$TEST_DIRECTORY"/lib-git-daemon.sh
12 start_git_daemon
--export-all --enable=receive-pack
13 daemon_parent
=$GIT_DAEMON_DOCUMENT_ROOT_PATH/parent
15 test_expect_success
'create repo to be served by git-daemon' '
16 git init "$daemon_parent" &&
17 test_commit -C "$daemon_parent" one
20 test_expect_success
'list refs with git:// using protocol v2' '
21 test_when_finished "rm -f log" &&
23 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
24 ls-remote --symref "$GIT_DAEMON_URL/parent" >actual &&
26 # Client requested to use protocol v2
27 grep "git> .*\\\0\\\0version=2\\\0$" log &&
28 # Server responded using protocol v2
29 grep "git< version 2" log &&
31 git ls-remote --symref "$GIT_DAEMON_URL/parent" >expect &&
32 test_cmp actual expect
35 test_expect_success
'ref advertisment is filtered with ls-remote using protocol v2' '
36 test_when_finished "rm -f log" &&
38 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
39 ls-remote "$GIT_DAEMON_URL/parent" master >actual &&
42 $(git -C "$daemon_parent" rev-parse refs/heads/master)$(printf "\t")refs/heads/master
45 test_cmp actual expect
50 # Test protocol v2 with 'file://' transport
52 test_expect_success
'create repo to be served by file:// transport' '
53 git init file_parent &&
54 test_commit -C file_parent one
57 test_expect_success
'list refs with file:// using protocol v2' '
58 test_when_finished "rm -f log" &&
60 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
61 ls-remote --symref "file://$(pwd)/file_parent" >actual &&
63 # Server responded using protocol v2
64 grep "git< version 2" log &&
66 git ls-remote --symref "file://$(pwd)/file_parent" >expect &&
67 test_cmp actual expect
70 test_expect_success
'ref advertisment is filtered with ls-remote using protocol v2' '
71 test_when_finished "rm -f log" &&
73 GIT_TRACE_PACKET="$(pwd)/log" git -c protocol.version=2 \
74 ls-remote "file://$(pwd)/file_parent" master >actual &&
77 $(git -C file_parent rev-parse refs/heads/master)$(printf "\t")refs/heads/master
80 test_cmp actual expect