RFC Allow fetch-pack to send ref names (globs allowed)
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest14 patches 13 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | upload-pack: move parsing of "want" lineupload-pack.c | +14 | 0 replies | |
| 2/14 | upload-pack: allow ref name and glob requestsDocumentation/ Documentation/ Documentation/ +2 more | +411 | 3 replies | |
| 3/14 | upload-pack: test negotiation with changing repot/ t/ t/ +2 more | +113 | 5 replies | |
| 4/14 | fetch: refactor the population of hashesbuiltin/ | +19 | 0 replies | |
| 5/14 | fetch: refactor fetch_refs into two functionsbuiltin/ | +13 | 0 replies | |
| 6/14 | fetch: refactor to make function args narrowerbuiltin/ | +12 | 0 replies | |
| 7/14 | fetch-pack: put shallow info in out parambuiltin/ builtin/ fetch-pack.c +6 more | +85 | 0 replies | |
| 8/14 | fetch-pack: check returned refs for matchesbuiltin/ fetch-pack.c fetch-pack.h +1 more | +13 | 0 replies | |
| 9/14 | transport: put ref oid in out parambuiltin/ builtin/ fetch-pack.c +4 more | +61 | 0 replies | |
| 10/14 | fetch-pack: support partial names and globsbuiltin/ remote.c remote.h +1 more | +122 | 0 replies | |
| 11/14 | fetch-pack: support want-refbuiltin/ fetch-pack.c fetch-pack.h +2 more | +175 | 0 replies | |
| 12/14 | fetch-pack: do not printf after closing stdoutbuiltin/ | +10 | 2 replies | |
| 13/14 | fetch: send want-ref and receive fetched refsbuiltin/ builtin/ builtin/ +5 more | +229 | 0 replies | |
| 14/14 | DONT USE advertise_ref_in_want=1t/ upload-pack.c | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC 00/14] Allow fetch-pack to send ref names (globs allowed)
Hello everyone - this is a proposal for a protocol change to allow the fetch-pack/upload-pack to converse in terms of ref names (globs allowed), and also an implementation of the server (upload-pack) and fetch-from-HTTP client (fetch-pack invoked through fetch).
Negotiation currently happens by upload-pack initially sending a list of refs with names and SHA-1 hashes, and then several request/response pairs in which the request from fetch-pack consists of SHA-1 hashes (selected from the initial list). Allowing the request to consist of names instead of SHA-1 hashes increases tolerance to refs changing (due to time, and due to having load-balanced servers without strong consistency), and is a step towards eliminating the need for the server to send the list of refs first (possibly improving performance).
The protocol is extended by allowing fetch-pack to send "want-ref <name>", where <name> is a full name (refs/...) [1], possibly including glob characters. Upload-pack will inform the client of the refs actually matched by sending "wanted-ref <SHA-1> <name>" before sending the last ACK or NAK.
This patch set is laid out in this way:
1-2:
Upload-pack, protocol documentation, tests that test upload-pack independently. A configuration option is added to control if the "ref-in-want" capability is advertised. (It is always supported even if not advertised - this is so that this feature in multiple load-balanced servers can be switched on or off without needing any atomic switching.)
3:
Mechanism to test a repo that changes over the negotiation (currently, only with the existing mechanism).
4-9:
The current transport mechanism takes in an array of refs which is used as both input and output. Since we are planning to extend the transport mechanism to also allow the specification of ref names (which may include globs, and thus do not have a 1-1 correspondence to refs), refactor to make this parameter to be solely an input parameter.
10-11:
Changes to fetch-pack (which is used by remote-curl) to support "want-ref".
12-13:
Changes to the rest (fetch -> transport -> transport-helper -> remote-curl) to support "want-ref" when fetching from HTTP. The transport fetch function signature has been widened to allow passing in ref names - transports may use those ref names instead of or in addition to refs if they support it. (I chose to preserve refs in the function signature because many parts of Git, including remote helpers, only understand the old functionality anyway, and because precalculating the refs allows some optimizations.)
14:
This is not meant for submission - this is just to show that the tests pass if ref-in-want was advertised by default (except for some newly added tests that explicitly check for the old behavior).
[1] There has been some discussion about whether the server should accept partial ref names, e.g. [2]. In this patch set, I have made the server only accept full names, and it is the responsibility of the client to send the multiple patterns which it wants to match. Quoting from the commit message of the second patch:
For example, a client could reasonably expand an abbreviated name "foo" to "want-ref foo", "want-ref refs/heads/foo", "want-ref refs/tags/foo", among others, and ensure that at least one such ref has been fetched.
[2] <[email protected]>
Jonathan Tan (14):
upload-pack: move parsing of "want" line
upload-pack: allow ref name and glob requests
upload-pack: test negotiation with changing repo
fetch: refactor the population of hashes
fetch: refactor fetch_refs into two functions
fetch: refactor to make function args narrower
fetch-pack: put shallow info in out param
fetch-pack: check returned refs for matches
transport: put ref oid in out param
fetch-pack: support partial names and globs
fetch-pack: support want-ref
fetch-pack: do not printf after closing stdout
fetch: send want-ref and receive fetched refs DONT USE advertise_ref_in_want=1
Documentation/technical/http-protocol.txt | 20 +- Documentation/technical/pack-protocol.txt | 24 +- Documentation/technical/protocol-capabilities.txt | 6 + builtin/clone.c | 16 +- builtin/fetch-pack.c | 64 ++-- builtin/fetch.c | 178 +++++++--- fetch-pack.c | 226 +++++++++---- fetch-pack.h | 6 +- remote-curl.c | 91 +++-- remote.c | 67 +++- remote.h | 20 +- t/lib-httpd.sh | 1 + t/lib-httpd/apache.conf | 8 + t/lib-httpd/one-time-sed.sh | 8 + t/t5500-fetch-pack.sh | 82 +++++ t/t5536-fetch-conflicts.sh | 2 + t/t5552-upload-pack-ref-in-want.sh | 386 ++++++++++++++++++++++ transport-helper.c | 105 ++++-- transport.c | 40 ++- transport.h | 23 +- upload-pack.c | 117 +++++-- 21 files changed, 1232 insertions(+), 258 deletions(-) create mode 100644 t/lib-httpd/one-time-sed.sh create mode 100755 t/t5552-upload-pack-ref-in-want.sh
Signature · 1 line
2.11.0.483.g087da7b7c-goog