From: Jeff King <peff@peff.net>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] Document smart http
Date: Tue, 20 Aug 2013 10:16:30 -0400 [thread overview]
Message-ID: <20130820141630.GB32370@sigill.intra.peff.net> (raw)
In-Reply-To: <1376975288-17079-1-git-send-email-pclouds@gmail.com>
On Tue, Aug 20, 2013 at 12:08:08PM +0700, Nguyen Thai Ngoc Duy wrote:
> 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).
> +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
> + 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
next prev parent reply other threads:[~2013-08-20 14:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 5:08 [PATCH] Document smart http Nguyễn Thái Ngọc Duy
2013-08-20 14:16 ` Jeff King [this message]
2013-08-20 14:20 ` Duy Nguyen
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=20130820141630.GB32370@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=spearce@spearce.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).