mirror of
https://github.com/git/git
synced 2024-09-13 05:14:36 +00:00
ed10cb952d
Introduce git-serve, the base server for protocol version 2. Protocol version 2 is intended to be a replacement for Git's current wire protocol. The intention is that it will be a simpler, less wasteful protocol which can evolve over time. Protocol version 2 improves upon version 1 by eliminating the initial ref advertisement. In its place a server will export a list of capabilities and commands which it supports in a capability advertisement. A client can then request that a particular command be executed by providing a number of capabilities and command specific parameters. At the completion of a command, a client can request that another command be executed or can terminate the connection by sending a flush packet. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
61 lines
1.2 KiB
Bash
Executable file
61 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='test git-serve and server commands'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'test capability advertisement' '
|
|
cat >expect <<-EOF &&
|
|
version 2
|
|
agent=git/$(git version | cut -d" " -f3)
|
|
0000
|
|
EOF
|
|
|
|
git serve --advertise-capabilities >out &&
|
|
test-pkt-line unpack <out >actual &&
|
|
test_cmp actual expect
|
|
'
|
|
|
|
test_expect_success 'stateless-rpc flag does not list capabilities' '
|
|
# Empty request
|
|
test-pkt-line pack >in <<-EOF &&
|
|
0000
|
|
EOF
|
|
git serve --stateless-rpc >out <in &&
|
|
test_must_be_empty out &&
|
|
|
|
# EOF
|
|
git serve --stateless-rpc >out &&
|
|
test_must_be_empty out
|
|
'
|
|
|
|
test_expect_success 'request invalid capability' '
|
|
test-pkt-line pack >in <<-EOF &&
|
|
foobar
|
|
0000
|
|
EOF
|
|
test_must_fail git serve --stateless-rpc 2>err <in &&
|
|
test_i18ngrep "unknown capability" err
|
|
'
|
|
|
|
test_expect_success 'request with no command' '
|
|
test-pkt-line pack >in <<-EOF &&
|
|
agent=git/test
|
|
0000
|
|
EOF
|
|
test_must_fail git serve --stateless-rpc 2>err <in &&
|
|
test_i18ngrep "no command requested" err
|
|
'
|
|
|
|
test_expect_success 'request invalid command' '
|
|
test-pkt-line pack >in <<-EOF &&
|
|
command=foo
|
|
agent=git/test
|
|
0000
|
|
EOF
|
|
test_must_fail git serve --stateless-rpc 2>err <in &&
|
|
test_i18ngrep "invalid command" err
|
|
'
|
|
|
|
test_done
|