serve: introduce the server-option capability
Introduce the "server-option" capability to protocol version 2. This enables future clients the ability to send server specific options in command requests when using protocol version 2. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
bbc39d4020
commit
ecc3e5342d
@ -393,3 +393,13 @@ header.
|
|||||||
1 - pack data
|
1 - pack data
|
||||||
2 - progress messages
|
2 - progress messages
|
||||||
3 - fatal error message just before stream aborts
|
3 - fatal error message just before stream aborts
|
||||||
|
|
||||||
|
server-option
|
||||||
|
~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
If advertised, indicates that any number of server specific options can be
|
||||||
|
included in a request. This is done by sending each option as a
|
||||||
|
"server-option=<option>" capability line in the capability-list section of
|
||||||
|
a request.
|
||||||
|
|
||||||
|
The provided options must not contain a NUL or LF character.
|
||||||
|
1
serve.c
1
serve.c
@ -56,6 +56,7 @@ static struct protocol_capability capabilities[] = {
|
|||||||
{ "agent", agent_advertise, NULL },
|
{ "agent", agent_advertise, NULL },
|
||||||
{ "ls-refs", always_advertise, ls_refs },
|
{ "ls-refs", always_advertise, ls_refs },
|
||||||
{ "fetch", upload_pack_advertise, upload_pack_v2 },
|
{ "fetch", upload_pack_advertise, upload_pack_v2 },
|
||||||
|
{ "server-option", always_advertise, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
static void advertise_capabilities(void)
|
static void advertise_capabilities(void)
|
||||||
|
@ -10,6 +10,7 @@ test_expect_success 'test capability advertisement' '
|
|||||||
agent=git/$(git version | cut -d" " -f3)
|
agent=git/$(git version | cut -d" " -f3)
|
||||||
ls-refs
|
ls-refs
|
||||||
fetch=shallow
|
fetch=shallow
|
||||||
|
server-option
|
||||||
0000
|
0000
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -173,4 +174,24 @@ test_expect_success 'symrefs parameter' '
|
|||||||
test_cmp actual expect
|
test_cmp actual expect
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'sending server-options' '
|
||||||
|
test-pkt-line pack >in <<-EOF &&
|
||||||
|
command=ls-refs
|
||||||
|
server-option=hello
|
||||||
|
server-option=world
|
||||||
|
0001
|
||||||
|
ref-prefix HEAD
|
||||||
|
0000
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >expect <<-EOF &&
|
||||||
|
$(git rev-parse HEAD) HEAD
|
||||||
|
0000
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git serve --stateless-rpc <in >out &&
|
||||||
|
test-pkt-line unpack <out >actual &&
|
||||||
|
test_cmp actual expect
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user