From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org, bmwill@google.com
Cc: Brandon Williams <bmwill@google.com>
Subject: [PATCH 1/3] serve: introduce the server-option capability
Date: Mon, 23 Apr 2018 15:46:22 -0700 [thread overview]
Message-ID: <20180423224624.213341-2-bmwill@google.com> (raw)
In-Reply-To: <20180423224624.213341-1-bmwill@google.com>
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>
---
Documentation/technical/protocol-v2.txt | 10 ++++++++++
serve.c | 1 +
t/t5701-git-serve.sh | 21 +++++++++++++++++++++
3 files changed, 32 insertions(+)
diff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt
index 136179d7d..d7b6f38e0 100644
--- a/Documentation/technical/protocol-v2.txt
+++ b/Documentation/technical/protocol-v2.txt
@@ -393,3 +393,13 @@ header.
1 - pack data
2 - progress messages
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.
diff --git a/serve.c b/serve.c
index a5a7b2f7d..bda085f09 100644
--- a/serve.c
+++ b/serve.c
@@ -56,6 +56,7 @@ static struct protocol_capability capabilities[] = {
{ "agent", agent_advertise, NULL },
{ "ls-refs", always_advertise, ls_refs },
{ "fetch", upload_pack_advertise, upload_pack_v2 },
+ { "server-option", always_advertise, NULL },
};
static void advertise_capabilities(void)
diff --git a/t/t5701-git-serve.sh b/t/t5701-git-serve.sh
index 72d7bc562..011a5796d 100755
--- a/t/t5701-git-serve.sh
+++ b/t/t5701-git-serve.sh
@@ -10,6 +10,7 @@ test_expect_success 'test capability advertisement' '
agent=git/$(git version | cut -d" " -f3)
ls-refs
fetch=shallow
+ server-option
0000
EOF
@@ -173,4 +174,24 @@ test_expect_success 'symrefs parameter' '
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
--
2.17.0.484.g0c8726318c-goog
next prev parent reply other threads:[~2018-04-23 22:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 22:46 [PATCH 0/3] optionally send server-options when using v2 Brandon Williams
2018-04-23 22:46 ` Brandon Williams [this message]
2018-04-23 22:46 ` [PATCH 2/3] ls-remote: send server options when using protocol v2 Brandon Williams
2018-04-23 22:46 ` [PATCH 3/3] fetch: " Brandon Williams
2018-04-23 22:47 ` [PATCH 0/3] optionally send server-options when using v2 Brandon Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180423224624.213341-2-bmwill@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).