The following patches extend what I sent out as an WIP
(https://public-inbox.org/git/[email protected]/) and
implement protocol version 2.
Some changes from that series are as follows:
* Lots of various cleanup on the ls-refs and fetch command code, both server
and client.
* Fetch command now supports a stateless-rpc mode which enables communicating
with a half-duplex connection.
* Introduce a new remote-helper command 'connect-half-duplex' which is
implemented by remote-curl (the http remote-helper). This allows for a
client to establish a half-duplex connection and use remote-curl as a proxy
to wrap requests in http before sending them to the remote end and
unwrapping the responses and sending them back to the client's stdin.
* The transport code is refactored for ls-remote, fetch, and push to provide a
list of ref-patterns (based on the refspec being used) when requesting refs
from the remote end. This allows the ls-refs code to send this list of
patterns so the remote end and filter the refs it sends back.
This series effectively implements protocol version 2 for listing a remotes
refs (ls-remote) as well as for fetch for the builtin transports (ssh, git,
file) and for the http/https transports. Push is not implemented yet and
doesn't need to be implemented at the same time as fetch since the
receive-pack code can default to using protocol v0 when v2 is requested by the
client.
Any feedback is appreciated! Thanks!
Brandon
Brandon Williams (26):
pkt-line: introduce packet_read_with_status
pkt-line: introduce struct packet_reader
pkt-line: add delim packet support
upload-pack: convert to a builtin
upload-pack: factor out processing lines
transport: use get_refs_via_connect to get refs
connect: convert get_remote_heads to use struct packet_reader
connect: discover protocol version outside of get_remote_heads
transport: store protocol version
protocol: introduce enum protocol_version value protocol_v2
serve: introduce git-serve
ls-refs: introduce ls-refs server command
connect: request remote refs using v2
transport: convert get_refs_list to take a list of ref patterns
transport: convert transport_get_remote_refs to take a list of ref
patterns
ls-remote: pass ref patterns when requesting a remote's refs
fetch: pass ref patterns when fetching
push: pass ref patterns when pushing
upload-pack: introduce fetch server command
fetch-pack: perform a fetch using v2
transport-helper: remove name parameter
transport-helper: refactor process_connect_service
transport-helper: introduce connect-half-duplex
pkt-line: add packet_buf_write_len function
remote-curl: create copy of the service name
remote-curl: implement connect-half-duplex command
.gitignore | 1 +
Documentation/technical/protocol-v2.txt | 131 ++++++++++
Makefile | 6 +-
builtin.h | 2 +
builtin/clone.c | 2 +-
builtin/fetch-pack.c | 21 +-
builtin/fetch.c | 14 +-
builtin/ls-remote.c | 7 +-
builtin/receive-pack.c | 6 +
builtin/remote.c | 2 +-
builtin/send-pack.c | 20 +-
builtin/serve.c | 30 +++
connect.c | 226 +++++++++++++-----
connect.h | 3 +
fetch-pack.c | 267 ++++++++++++++++++++-
fetch-pack.h | 4 +-
git.c | 2 +
ls-refs.c | 97 ++++++++
ls-refs.h | 9 +
pkt-line.c | 147 +++++++++++-
pkt-line.h | 76 ++++++
protocol.c | 2 +
protocol.h | 1 +
remote-curl.c | 209 +++++++++++++++-
remote.h | 9 +-
serve.c | 243 +++++++++++++++++++
serve.h | 15 ++
t/t5701-protocol-v2.sh | 117 +++++++++
transport-helper.c | 84 ++++---
transport-internal.h | 4 +-
transport.c | 119 ++++++---
transport.h | 9 +-
upload-pack.c | 412 ++++++++++++++++++++++++++++----
upload-pack.h | 9 +
34 files changed, 2108 insertions(+), 198 deletions(-)
create mode 100644 Documentation/technical/protocol-v2.txt
create mode 100644 builtin/serve.c
create mode 100644 ls-refs.c
create mode 100644 ls-refs.h
create mode 100644 serve.c
create mode 100644 serve.h
create mode 100755 t/t5701-protocol-v2.sh
create mode 100644 upload-pack.h
--
2.15.1.620.gb9897f4670-goog