Document smart http
PATCH 1/1 Document smart http
This may provide some clues for those who want to modify smart http code as smart http is pretty much undocumented. Smart http "document" so far is a few commit messages and the source code.
--- Documentation/git-fetch-pack.txt | 11 +++-- Documentation/git-receive-pack.txt | 12 +++++- Documentation/git-send-pack.txt | 9 +++- Documentation/git-upload-pack.txt | 9 +++- Documentation/technical/pack-protocol.txt | 69 +++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 7 deletions(-)
Documentation/git-fetch-pack.txt +7 -4
@@ -9,10 +9,7 @@ git-fetch-pack - Receive missing objects from another repository SYNOPSIS -------- [verse] -'git fetch-pack' [--all] [--quiet|-q] [--keep|-k] [--thin] [--include-tag] - [--upload-pack=<git-upload-pack>] - [--depth=<n>] [--no-progress] - [-v] [<host>:]<directory> [<refs>...] +'git fetch-pack' [options] [<host>:]<directory> [<refs>...] DESCRIPTION -----------
@@ -90,6 +87,12 @@ be in a separate packet, and the list must end with a flush packet. --no-progress:: Do not show the progress. +--stateless-rpc:: + Smart HTTP mode. + +--lock-pack:: + Issue "lock" command to the remote helper via stdout. + -v:: Run verbosely.
Documentation/git-receive-pack.txt +11 -1
@@ -9,7 +9,7 @@ git-receive-pack - Receive what is pushed into the repository SYNOPSIS -------- [verse] -'git-receive-pack' <directory> +'git-receive-pack' [options] <directory> DESCRIPTION -----------
@@ -35,6 +35,16 @@ are not fast-forwards. OPTIONS ------- +--stateless-rpc:: + Smart HTTP mode. + +--advertise-refs:: + Only the initial ref advertisement is output then exits + immediately. + +--quiet:: + Make unpack-objects at the receive-pack end quiet. + <directory>:: The repository to sync into.
Documentation/git-send-pack.txt +8 -1
@@ -9,7 +9,7 @@ git-send-pack - Push objects over Git protocol to another repository SYNOPSIS -------- [verse] -'git send-pack' [--all] [--dry-run] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...] +'git send-pack' [options] [<host>:]<directory> [<ref>...] DESCRIPTION -----------
@@ -52,6 +52,13 @@ OPTIONS Send a "thin" pack, which records objects in deltified form based on objects not included in the pack to reduce network traffic. +--stateless-rpc:: + Smart HTTP mode. + +--helper-status: + Issue status commands (e.g. "ok" or "error") to the remote + helper via stdout. + <host>:: A remote host to house the repository. When this part is specified, 'git-receive-pack' is invoked via
Documentation/git-upload-pack.txt +8 -1
@@ -9,7 +9,7 @@ git-upload-pack - Send objects packed back to git-fetch-pack SYNOPSIS -------- [verse] -'git-upload-pack' [--strict] [--timeout=<n>] <directory> +'git-upload-pack' [options] <directory> DESCRIPTION -----------
@@ -31,6 +31,13 @@ OPTIONS --timeout=<n>:: Interrupt transfer after <n> seconds of inactivity. +--stateless-rpc:: + Smart HTTP mode. + +--advertise-refs:: + Only the initial ref advertisement is output then exits + immediately. + <directory>:: The repository to sync from.
Documentation/technical/pack-protocol.txt +69 -0
72 lines not on this page · raw message
Signature · 1 line
1.8.2.82.gc24b958
Quoted 3 lines · Nguyen Thai Ngoc Duy
This may provide some clues for those who want to modify smart http code as smart http is pretty much undocumented. Smart http "document" so far is a few commit messages and the source code.
There was also this:
http://article.gmane.org/gmane.comp.version-control.git/129734
which seems to have never gotten updated enough to be applied along with the code. But with some updates to make sure it matches the current behavior, it is probably a more comprehensive description.
But if you don't feel like spending more time on this on top of what you've already done, I think the patch I'm responding to is better than what we have now (i.e., nothing).
Quoted 24 lines
Documentation/technical/pack-protocol.txt +24
-0+Reference Discovery +------------------- + +The server end always sends the list of references in both push and +fetch cases. This ref list is retrieved by the client's sending HTTP +GET request to a smart http url ending with +"/info/refs?service=<service>" where <service> could be either +git-upload-pack or git-receive-pack for fetching or pushing +respectively. The output is in pkt-line format. + +---- + advertised-refs = service + flush-pkt + (no-refs / list-of-refs) + flush-pkt + + service = PKT-LINE("# service=" service-name) + service-name = ("git-upload-pack" / "git-receive-pack") + + no-refs = PKT-LINE(zero-id SP "capabilities^{}" + NUL capability-list LF) + + list-of-refs = first-ref *other-ref + first-ref = PKT-LINE(obj-id SP refname
Documentation/technical/pack-protocol.txt An example client/server communication might look like this: · line 594
Quoted 10 lines
Documentation/technical/pack-protocol.txt +10
-0+ NUL capability-list LF) + + other-ref = PKT-LINE(other-tip / other-peeled) + other-tip = obj-id SP refname LF + other-peeled = obj-id SP refname "^{}" LF + + capability-list = capability *(SP capability) + capability = 1*(LC_ALPHA / DIGIT / "-" / "_") + LC_ALPHA = %x61-7A +----
Most of this is a repeat of what is in the earlier sections. I don't think the protocol is changing much and these are not likely to get out of date with each other, but I wonder if it is easier on the reader to simply describe the output in terms of what is added on top of the regular ref advertisement (i.e., the service line). Something like:
stateless-advertised-refs = service
advertised-refs
service = PKT-LINE("# service=" service-name)
service-name = ("git-upload-pack" / "git-receive-pack")where advertised-refs is defined in the earlier BNF. You may also want to note:
Servers may respond to a smart request with a regular advertised-refs response rather than a stateless-advertised-refs response. In this case, the client MUST assume that the server does not understand smart HTTP and either abort or proceed with the non-smart protocol.
-Peff
Quoted 6 lines · Jeff King
Quoted 3 lines · Nguyen Thai Ngoc Duy
This may provide some clues for those who want to modify smart http code as smart http is pretty much undocumented. Smart http "document" so far is a few commit messages and the source code.
Quoted 7 lines
There was also this:
http://article.gmane.org/gmane.comp.version-control.git/129734
which seems to have never gotten updated enough to be applied along with the code. But with some updates to make sure it matches the current behavior, it is probably a more comprehensive description.
If I knew about this patch, it could have saved me a lot of time reading remote-curl.c. Will check it with current code and resubmit an update of this version instead.
Signature · 1 line
Duy