[PATCH v6 0/1] Advertise multiple supported proto versions
- From
Josh Steadmon <steadmon@google.com>
- Date
- Dec 20, 2018, 21:58 UTC
- Message-ID
- <cover.1545342797.git.steadmon@google.com>
- In-Reply-To
- <cover.1538516853.git.steadmon@google.com>
Add a registry of supported wire protocol versions that individual commands can use to declare supported versions before contacting a server. The client will then advertise all supported versions, while the server will choose the first allowed version from the advertised list.
Every command that acts as a client or server must now register its supported protocol versions.
Changes since V4: remove special cases around advertising version=0.
Changes since V5: no code changes, but corrected and clarified commit message regarding changes around advertising version=0.
Josh Steadmon (1): protocol: advertise multiple supported versions
builtin/archive.c | 3 + builtin/clone.c | 4 ++ builtin/fetch-pack.c | 4 ++ builtin/fetch.c | 5 ++ builtin/ls-remote.c | 5 ++ builtin/pull.c | 5 ++ builtin/push.c | 4 ++ builtin/receive-pack.c | 3 + builtin/send-pack.c | 3 + builtin/upload-archive.c | 3 + builtin/upload-pack.c | 4 ++ connect.c | 52 +++++++-------- protocol.c | 122 +++++++++++++++++++++++++++++++++--- protocol.h | 23 ++++++- remote-curl.c | 27 +++++--- t/t5551-http-fetch-smart.sh | 1 + t/t5570-git-daemon.sh | 2 +- t/t5601-clone.sh | 38 +++++------ t/t5700-protocol-v1.sh | 8 +-- t/t5702-protocol-v2.sh | 16 +++-- transport-helper.c | 6 ++ 21 files changed, 256 insertions(+), 82 deletions(-)
Range-diff against v5:
1: 60f6f2fbd8 ! 1: 10039ca163 protocol: advertise multiple supported versions
@@ -22,10 +22,12 @@
select the first allowed version from this advertisement.
Additionally, remove special cases around advertising version=0.
- Previously we avoided adding version negotiation fields in server
- responses if it looked like the client wanted v0. However, including
- these fields does not change behavior, so it's better to have simpler
- code.
+ Previously we avoided adding version advertisements to the client's
+ initial connection request if the client wanted version=0. However,
+ including these advertisements does not change the version negotiation
+ behavior, so it's better to have simpler code. As a side effect, this
+ means that client operations over SSH will always include a
+ "SendEnv=GIT_PROTOCOL" option on the SSH command line.
While we're at it, remove unnecessary externs from function declarations
in protocol.h.-- 2.20.1.415.g653613c723-goog