2022-08-04 18:28:41 +02:00
|
|
|
gitprotocol-http(5)
|
|
|
|
===================
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
|
|
|
gitprotocol-http - Git HTTP-based protocols
|
|
|
|
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
[verse]
|
|
|
|
<over-the-wire-protocol>
|
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Git supports two HTTP based transfer protocols. A "dumb" protocol
|
|
|
|
which requires only a standard HTTP server on the server end of the
|
|
|
|
connection, and a "smart" protocol which requires a Git aware CGI
|
|
|
|
(or server module). This document describes both protocols.
|
|
|
|
|
|
|
|
As a design feature smart clients can automatically upgrade "dumb"
|
|
|
|
protocol URLs to smart URLs. This permits all users to have the
|
|
|
|
same published URL, and the peers automatically select the most
|
|
|
|
efficient transport available to them.
|
|
|
|
|
|
|
|
|
|
|
|
URL Format
|
|
|
|
----------
|
|
|
|
|
|
|
|
URLs for Git repositories accessed by HTTP use the standard HTTP
|
|
|
|
URL syntax documented by RFC 1738, so they are of the form:
|
|
|
|
|
|
|
|
http://<host>:<port>/<path>?<searchpart>
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Within this documentation the placeholder `$GIT_URL` will stand for
|
2013-08-21 15:45:13 +02:00
|
|
|
the http:// repository URL entered by the end-user.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Servers SHOULD handle all requests to locations matching `$GIT_URL`, as
|
2013-08-21 15:45:13 +02:00
|
|
|
both the "smart" and "dumb" HTTP protocols used by Git operate
|
|
|
|
by appending additional path components onto the end of the user
|
2014-01-26 13:57:19 +01:00
|
|
|
supplied `$GIT_URL` string.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
An example of a dumb client requesting for a loose object:
|
|
|
|
|
|
|
|
$GIT_URL: http://example.com:8080/git/repo.git
|
|
|
|
URL request: http://example.com:8080/git/repo.git/objects/d0/49f6c27a2244e12041955e262a404c7faba355
|
|
|
|
|
|
|
|
An example of a smart request to a catch-all gateway:
|
|
|
|
|
|
|
|
$GIT_URL: http://example.com/daemon.cgi?svc=git&q=
|
|
|
|
URL request: http://example.com/daemon.cgi?svc=git&q=/info/refs&service=git-receive-pack
|
|
|
|
|
|
|
|
An example of a request to a submodule:
|
|
|
|
|
|
|
|
$GIT_URL: http://example.com/git/repo.git/path/submodule.git
|
|
|
|
URL request: http://example.com/git/repo.git/path/submodule.git/info/refs
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Clients MUST strip a trailing `/`, if present, from the user supplied
|
|
|
|
`$GIT_URL` string to prevent empty path tokens (`//`) from appearing
|
2013-08-21 15:45:13 +02:00
|
|
|
in any URL sent to a server. Compatible clients MUST expand
|
2014-01-26 13:57:19 +01:00
|
|
|
`$GIT_URL/info/refs` as `foo/info/refs` and not `foo//info/refs`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
Authentication
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Standard HTTP authentication is used if authentication is required
|
|
|
|
to access a repository, and MAY be configured and enforced by the
|
|
|
|
HTTP server software.
|
|
|
|
|
|
|
|
Because Git repositories are accessed by standard path components
|
|
|
|
server administrators MAY use directory based permissions within
|
|
|
|
their HTTP server to control repository access.
|
|
|
|
|
2014-06-14 21:09:29 +02:00
|
|
|
Clients SHOULD support Basic authentication as described by RFC 2617.
|
2013-08-21 15:45:13 +02:00
|
|
|
Servers SHOULD support Basic authentication by relying upon the
|
|
|
|
HTTP server placed in front of the Git server software.
|
|
|
|
|
|
|
|
Servers SHOULD NOT require HTTP cookies for the purposes of
|
|
|
|
authentication or access control.
|
|
|
|
|
|
|
|
Clients and servers MAY support other common forms of HTTP based
|
|
|
|
authentication, such as Digest authentication.
|
|
|
|
|
|
|
|
|
|
|
|
SSL
|
|
|
|
---
|
|
|
|
|
|
|
|
Clients and servers SHOULD support SSL, particularly to protect
|
|
|
|
passwords when relying on Basic HTTP authentication.
|
|
|
|
|
|
|
|
|
|
|
|
Session State
|
|
|
|
-------------
|
|
|
|
|
|
|
|
The Git over HTTP protocol (much like HTTP itself) is stateless
|
|
|
|
from the perspective of the HTTP server side. All state MUST be
|
|
|
|
retained and managed by the client process. This permits simple
|
|
|
|
round-robin load-balancing on the server side, without needing to
|
|
|
|
worry about state management.
|
|
|
|
|
|
|
|
Clients MUST NOT require state management on the server side in
|
|
|
|
order to function correctly.
|
|
|
|
|
|
|
|
Servers MUST NOT require HTTP cookies in order to function correctly.
|
|
|
|
Clients MAY store and forward HTTP cookies during request processing
|
|
|
|
as described by RFC 2616 (HTTP/1.1). Servers SHOULD ignore any
|
|
|
|
cookies sent by a client.
|
|
|
|
|
|
|
|
|
|
|
|
General Request Processing
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
Except where noted, all standard HTTP behavior SHOULD be assumed
|
|
|
|
by both client and server. This includes (but is not necessarily
|
|
|
|
limited to):
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
If there is no repository at `$GIT_URL`, or the resource pointed to by a
|
|
|
|
location matching `$GIT_URL` does not exist, the server MUST NOT respond
|
|
|
|
with `200 OK` response. A server SHOULD respond with
|
|
|
|
`404 Not Found`, `410 Gone`, or any other suitable HTTP status code
|
2013-08-21 15:45:13 +02:00
|
|
|
which does not imply the resource exists as requested.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
If there is a repository at `$GIT_URL`, but access is not currently
|
|
|
|
permitted, the server MUST respond with the `403 Forbidden` HTTP
|
2013-08-21 15:45:13 +02:00
|
|
|
status code.
|
|
|
|
|
|
|
|
Servers SHOULD support both HTTP 1.0 and HTTP 1.1.
|
|
|
|
Servers SHOULD support chunked encoding for both request and response
|
|
|
|
bodies.
|
|
|
|
|
|
|
|
Clients SHOULD support both HTTP 1.0 and HTTP 1.1.
|
|
|
|
Clients SHOULD support chunked encoding for both request and response
|
|
|
|
bodies.
|
|
|
|
|
|
|
|
Servers MAY return ETag and/or Last-Modified headers.
|
|
|
|
|
|
|
|
Clients MAY revalidate cached entities by including If-Modified-Since
|
|
|
|
and/or If-None-Match request headers.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Servers MAY return `304 Not Modified` if the relevant headers appear
|
2013-08-21 15:45:13 +02:00
|
|
|
in the request and the entity has not changed. Clients MUST treat
|
2014-01-26 13:57:19 +01:00
|
|
|
`304 Not Modified` identical to `200 OK` by reusing the cached entity.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Clients MAY reuse a cached entity without revalidation if the
|
|
|
|
Cache-Control and/or Expires header permits caching. Clients and
|
|
|
|
servers MUST follow RFC 2616 for cache controls.
|
|
|
|
|
|
|
|
|
|
|
|
Discovering References
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
All HTTP clients MUST begin either a fetch or a push exchange by
|
|
|
|
discovering the references available on the remote repository.
|
|
|
|
|
|
|
|
Dumb Clients
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
|
|
HTTP clients that only support the "dumb" protocol MUST discover
|
|
|
|
references by making a request for the special info/refs file of
|
|
|
|
the repository.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Dumb HTTP clients MUST make a `GET` request to `$GIT_URL/info/refs`,
|
2013-08-21 15:45:13 +02:00
|
|
|
without any search/query parameters.
|
|
|
|
|
|
|
|
C: GET $GIT_URL/info/refs HTTP/1.0
|
|
|
|
|
|
|
|
S: 200 OK
|
|
|
|
S:
|
|
|
|
S: 95dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint
|
|
|
|
S: d049f6c27a2244e12041955e262a404c7faba355 refs/heads/master
|
|
|
|
S: 2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0
|
|
|
|
S: a3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}
|
|
|
|
|
|
|
|
The Content-Type of the returned info/refs entity SHOULD be
|
2014-01-26 13:57:19 +01:00
|
|
|
`text/plain; charset=utf-8`, but MAY be any content type.
|
2013-08-21 15:45:13 +02:00
|
|
|
Clients MUST NOT attempt to validate the returned Content-Type.
|
|
|
|
Dumb servers MUST NOT return a return type starting with
|
2014-01-26 13:57:19 +01:00
|
|
|
`application/x-git-`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Cache-Control headers MAY be returned to disable caching of the
|
|
|
|
returned entity.
|
|
|
|
|
|
|
|
When examining the response clients SHOULD only examine the HTTP
|
2014-01-26 13:57:19 +01:00
|
|
|
status code. Valid responses are `200 OK`, or `304 Not Modified`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
The returned content is a UNIX formatted text file describing
|
|
|
|
each ref and its known value. The file SHOULD be sorted by name
|
|
|
|
according to the C locale ordering. The file SHOULD NOT include
|
2014-01-26 13:57:19 +01:00
|
|
|
the default ref named `HEAD`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
info_refs = *( ref_record )
|
|
|
|
ref_record = any_ref / peeled_ref
|
|
|
|
|
|
|
|
any_ref = obj-id HTAB refname LF
|
|
|
|
peeled_ref = obj-id HTAB refname LF
|
|
|
|
obj-id HTAB refname "^{}" LF
|
|
|
|
|
|
|
|
Smart Clients
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
HTTP clients that support the "smart" protocol (or both the
|
|
|
|
"smart" and "dumb" protocols) MUST discover references by making
|
|
|
|
a parameterized request for the info/refs file of the repository.
|
|
|
|
|
|
|
|
The request MUST contain exactly one query parameter,
|
2014-01-26 13:57:19 +01:00
|
|
|
`service=$servicename`, where `$servicename` MUST be the service
|
2013-08-21 15:45:13 +02:00
|
|
|
name the client wishes to contact to complete the operation.
|
|
|
|
The request MUST NOT contain additional query parameters.
|
|
|
|
|
|
|
|
C: GET $GIT_URL/info/refs?service=git-upload-pack HTTP/1.0
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
dumb server reply:
|
|
|
|
|
2013-08-21 15:45:13 +02:00
|
|
|
S: 200 OK
|
|
|
|
S:
|
|
|
|
S: 95dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint
|
|
|
|
S: d049f6c27a2244e12041955e262a404c7faba355 refs/heads/master
|
|
|
|
S: 2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0
|
|
|
|
S: a3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
smart server reply:
|
|
|
|
|
2013-08-21 15:45:13 +02:00
|
|
|
S: 200 OK
|
|
|
|
S: Content-Type: application/x-git-upload-pack-advertisement
|
|
|
|
S: Cache-Control: no-cache
|
|
|
|
S:
|
|
|
|
S: 001e# service=git-upload-pack\n
|
2018-03-03 06:27:08 +01:00
|
|
|
S: 0000
|
2013-08-21 15:45:13 +02:00
|
|
|
S: 004895dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint\0multi_ack\n
|
2020-05-21 13:32:38 +02:00
|
|
|
S: 003fd049f6c27a2244e12041955e262a404c7faba355 refs/heads/master\n
|
2013-08-21 15:45:13 +02:00
|
|
|
S: 003c2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0\n
|
|
|
|
S: 003fa3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}\n
|
2018-03-03 06:27:08 +01:00
|
|
|
S: 0000
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2017-10-16 19:55:32 +02:00
|
|
|
The client may send Extra Parameters (see
|
2022-08-04 18:28:36 +02:00
|
|
|
linkgit:gitprotocol-pack[5]) as a colon-separated string
|
2017-10-16 19:55:32 +02:00
|
|
|
in the Git-Protocol HTTP header.
|
|
|
|
|
2021-08-05 03:25:43 +02:00
|
|
|
Uses the `--http-backend-info-refs` option to
|
|
|
|
linkgit:git-upload-pack[1].
|
|
|
|
|
2013-08-21 15:45:13 +02:00
|
|
|
Dumb Server Response
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
Dumb servers MUST respond with the dumb server reply format.
|
|
|
|
|
|
|
|
See the prior section under dumb clients for a more detailed
|
|
|
|
description of the dumb server response.
|
|
|
|
|
|
|
|
Smart Server Response
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
If the server does not recognize the requested service name, or the
|
|
|
|
requested service name has been disabled by the server administrator,
|
2014-01-26 13:57:19 +01:00
|
|
|
the server MUST respond with the `403 Forbidden` HTTP status code.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Otherwise, smart servers MUST respond with the smart server reply
|
|
|
|
format for the requested service name.
|
|
|
|
|
|
|
|
Cache-Control headers SHOULD be used to disable caching of the
|
|
|
|
returned entity.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
The Content-Type MUST be `application/x-$servicename-advertisement`.
|
2013-08-21 15:45:13 +02:00
|
|
|
Clients SHOULD fall back to the dumb protocol if another content
|
|
|
|
type is returned. When falling back to the dumb protocol clients
|
2014-01-26 13:57:19 +01:00
|
|
|
SHOULD NOT make an additional request to `$GIT_URL/info/refs`, but
|
2013-08-21 15:45:13 +02:00
|
|
|
instead SHOULD use the response already in hand. Clients MUST NOT
|
|
|
|
continue if they do not support the dumb protocol.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Clients MUST validate the status code is either `200 OK` or
|
|
|
|
`304 Not Modified`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Clients MUST validate the first five bytes of the response entity
|
2014-01-26 13:57:19 +01:00
|
|
|
matches the regex `^[0-9a-f]{4}#`. If this test fails, clients
|
2013-08-21 15:45:13 +02:00
|
|
|
MUST NOT continue.
|
|
|
|
|
|
|
|
Clients MUST parse the entire response as a sequence of pkt-line
|
|
|
|
records.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Clients MUST verify the first pkt-line is `# service=$servicename`.
|
2013-08-21 15:45:13 +02:00
|
|
|
Servers MUST set $servicename to be the request parameter value.
|
|
|
|
Servers SHOULD include an LF at the end of this line.
|
|
|
|
Clients MUST ignore an LF at the end of the line.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Servers MUST terminate the response with the magic `0000` end
|
2013-08-21 15:45:13 +02:00
|
|
|
pkt-line marker.
|
|
|
|
|
|
|
|
The returned response is a pkt-line stream describing each ref and
|
|
|
|
its known value. The stream SHOULD be sorted by name according to
|
|
|
|
the C locale ordering. The stream SHOULD include the default ref
|
2014-01-26 13:57:19 +01:00
|
|
|
named `HEAD` as the first ref. The stream MUST include capability
|
2013-08-21 15:45:13 +02:00
|
|
|
declarations behind a NUL on the first ref.
|
|
|
|
|
2017-10-16 19:55:32 +02:00
|
|
|
The returned response contains "version 1" if "version=1" was sent as an
|
|
|
|
Extra Parameter.
|
|
|
|
|
2013-08-21 15:45:13 +02:00
|
|
|
smart_reply = PKT-LINE("# service=$servicename" LF)
|
2018-03-03 06:27:08 +01:00
|
|
|
"0000"
|
2017-10-16 19:55:32 +02:00
|
|
|
*1("version 1")
|
2013-08-21 15:45:13 +02:00
|
|
|
ref_list
|
|
|
|
"0000"
|
|
|
|
ref_list = empty_list / non_empty_list
|
|
|
|
|
|
|
|
empty_list = PKT-LINE(zero-id SP "capabilities^{}" NUL cap-list LF)
|
|
|
|
|
|
|
|
non_empty_list = PKT-LINE(obj-id SP name NUL cap_list LF)
|
|
|
|
*ref_record
|
|
|
|
|
|
|
|
cap-list = capability *(SP capability)
|
|
|
|
capability = 1*(LC_ALPHA / DIGIT / "-" / "_")
|
|
|
|
LC_ALPHA = %x61-7A
|
|
|
|
|
|
|
|
ref_record = any_ref / peeled_ref
|
|
|
|
any_ref = PKT-LINE(obj-id SP name LF)
|
|
|
|
peeled_ref = PKT-LINE(obj-id SP name LF)
|
|
|
|
PKT-LINE(obj-id SP name "^{}" LF
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
|
2013-08-21 15:45:13 +02:00
|
|
|
Smart Service git-upload-pack
|
|
|
|
------------------------------
|
2014-01-26 13:57:19 +01:00
|
|
|
This service reads from the repository pointed to by `$GIT_URL`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Clients MUST first perform ref discovery with
|
2014-01-26 13:57:19 +01:00
|
|
|
`$GIT_URL/info/refs?service=git-upload-pack`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
C: POST $GIT_URL/git-upload-pack HTTP/1.0
|
|
|
|
C: Content-Type: application/x-git-upload-pack-request
|
|
|
|
C:
|
|
|
|
C: 0032want 0a53e9ddeaddad63ad106860237bbf53411d11a7\n
|
|
|
|
C: 0032have 441b40d833fdfa93eb2908e52742248faf0ee993\n
|
|
|
|
C: 0000
|
|
|
|
|
|
|
|
S: 200 OK
|
|
|
|
S: Content-Type: application/x-git-upload-pack-result
|
|
|
|
S: Cache-Control: no-cache
|
|
|
|
S:
|
|
|
|
S: ....ACK %s, continue
|
|
|
|
S: ....NAK
|
|
|
|
|
2013-11-12 16:17:43 +01:00
|
|
|
Clients MUST NOT reuse or revalidate a cached response.
|
2013-08-21 15:45:13 +02:00
|
|
|
Servers MUST include sufficient Cache-Control headers
|
|
|
|
to prevent caching of the response.
|
|
|
|
|
|
|
|
Servers SHOULD support all capabilities defined here.
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Clients MUST send at least one "want" command in the request body.
|
|
|
|
Clients MUST NOT reference an id in a "want" command which did not
|
2013-08-21 15:45:13 +02:00
|
|
|
appear in the response obtained through ref discovery unless the
|
2015-05-21 22:23:39 +02:00
|
|
|
server advertises capability `allow-tip-sha1-in-want` or
|
|
|
|
`allow-reachable-sha1-in-want`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
compute_request = want_list
|
|
|
|
have_list
|
|
|
|
request_end
|
|
|
|
request_end = "0000" / "done"
|
|
|
|
|
2018-07-28 23:16:30 +02:00
|
|
|
want_list = PKT-LINE(want SP cap_list LF)
|
2013-08-21 15:45:13 +02:00
|
|
|
*(want_pkt)
|
|
|
|
want_pkt = PKT-LINE(want LF)
|
|
|
|
want = "want" SP id
|
2018-07-28 23:16:30 +02:00
|
|
|
cap_list = capability *(SP capability)
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
have_list = *PKT-LINE("have" SP id LF)
|
|
|
|
|
|
|
|
TODO: Document this further.
|
|
|
|
|
|
|
|
The Negotiation Algorithm
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
The computation to select the minimal pack proceeds as follows
|
2014-01-26 13:57:19 +01:00
|
|
|
(C = client, S = server):
|
|
|
|
|
|
|
|
'init step:'
|
|
|
|
|
|
|
|
C: Use ref discovery to obtain the advertised refs.
|
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
C: Place any object seen into set `advertised`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
C: Build an empty set, `common`, to hold the objects that are later
|
2014-01-26 13:57:19 +01:00
|
|
|
determined to be on both ends.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
C: Build a set, `want`, of the objects from `advertised` the client
|
2014-01-26 13:57:19 +01:00
|
|
|
wants to fetch, based on what it saw during ref discovery.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
C: Start a queue, `c_pending`, ordered by commit time (popping newest
|
2014-01-26 13:57:19 +01:00
|
|
|
first). Add all client refs. When a commit is popped from
|
|
|
|
the queue its parents SHOULD be automatically inserted back.
|
|
|
|
Commits MUST only enter the queue once.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
'one compute step:'
|
|
|
|
|
|
|
|
C: Send one `$GIT_URL/git-upload-pack` request:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
C: 0032want <want #1>...............................
|
|
|
|
C: 0032want <want #2>...............................
|
2013-08-21 15:45:13 +02:00
|
|
|
....
|
2014-01-26 13:56:17 +01:00
|
|
|
C: 0032have <common #1>.............................
|
|
|
|
C: 0032have <common #2>.............................
|
2013-08-21 15:45:13 +02:00
|
|
|
....
|
2014-01-26 13:56:17 +01:00
|
|
|
C: 0032have <have #1>...............................
|
|
|
|
C: 0032have <have #2>...............................
|
2013-08-21 15:45:13 +02:00
|
|
|
....
|
|
|
|
C: 0000
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
The stream is organized into "commands", with each command
|
2014-05-21 20:52:26 +02:00
|
|
|
appearing by itself in a pkt-line. Within a command line,
|
2014-01-26 13:57:19 +01:00
|
|
|
the text leading up to the first space is the command name,
|
|
|
|
and the remainder of the line to the first LF is the value.
|
|
|
|
Command lines are terminated with an LF as the last byte of
|
|
|
|
the pkt-line value.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Commands MUST appear in the following order, if they appear
|
|
|
|
at all in the request stream:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
* "want"
|
|
|
|
* "have"
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
The stream is terminated by a pkt-line flush (`0000`).
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
A single "want" or "have" command MUST have one hex formatted
|
2020-08-15 18:05:59 +02:00
|
|
|
object name as its value. Multiple object names MUST be sent by sending
|
|
|
|
multiple commands. Object names MUST be given using the object format
|
|
|
|
negotiated through the `object-format` capability (default SHA-1).
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
The `have` list is created by popping the first 32 commits
|
|
|
|
from `c_pending`. Less can be supplied if `c_pending` empties.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
If the client has sent 256 "have" commits and has not yet
|
|
|
|
received one of those back from `s_common`, or the client has
|
|
|
|
emptied `c_pending` it SHOULD include a "done" command to let
|
2014-01-26 13:57:19 +01:00
|
|
|
the server know it won't proceed:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
C: 0009done
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
S: Parse the git-upload-pack request:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
Verify all objects in `want` are directly reachable from refs.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
The server MAY walk backwards through history or through
|
|
|
|
the reflog to permit slightly stale requests.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
If no "want" objects are received, send an error:
|
2014-01-26 13:57:19 +01:00
|
|
|
TODO: Define error if no "want" lines are requested.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
If any "want" object is not reachable, send an error:
|
2014-01-26 13:57:19 +01:00
|
|
|
TODO: Define error if an invalid "want" is requested.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:56:17 +01:00
|
|
|
Create an empty list, `s_common`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
If "have" was sent:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Loop through the objects in the order supplied by the client.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
For each object, if the server has the object reachable from
|
2014-01-26 13:56:17 +01:00
|
|
|
a ref, add it to `s_common`. If a commit is added to `s_common`,
|
|
|
|
do not add any ancestors, even if they also appear in `have`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
S: Send the git-upload-pack response:
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
If the server has found a closed set of objects to pack or the
|
|
|
|
request ends with "done", it replies with the pack.
|
2013-08-21 15:45:13 +02:00
|
|
|
TODO: Document the pack based response
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
S: PACK...
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
The returned stream is the side-band-64k protocol supported
|
|
|
|
by the git-upload-pack service, and the pack is embedded into
|
|
|
|
stream 1. Progress messages from the server side MAY appear
|
|
|
|
in stream 2.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
Here a "closed set of objects" is defined to have at least
|
2014-01-26 13:56:17 +01:00
|
|
|
one path from every "want" to at least one "common" object.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
If the server needs more information, it replies with a
|
|
|
|
status continue response:
|
2013-08-21 15:45:13 +02:00
|
|
|
TODO: Document the non-pack response
|
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
C: Parse the upload-pack response:
|
|
|
|
TODO: Document parsing response
|
2013-08-21 15:45:13 +02:00
|
|
|
|
2014-01-26 13:57:19 +01:00
|
|
|
'Do another compute step.'
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
Smart Service git-receive-pack
|
|
|
|
------------------------------
|
2014-01-26 13:57:19 +01:00
|
|
|
This service reads from the repository pointed to by `$GIT_URL`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
Clients MUST first perform ref discovery with
|
2014-01-26 13:57:19 +01:00
|
|
|
`$GIT_URL/info/refs?service=git-receive-pack`.
|
2013-08-21 15:45:13 +02:00
|
|
|
|
|
|
|
C: POST $GIT_URL/git-receive-pack HTTP/1.0
|
|
|
|
C: Content-Type: application/x-git-receive-pack-request
|
|
|
|
C:
|
|
|
|
C: ....0a53e9ddeaddad63ad106860237bbf53411d11a7 441b40d833fdfa93eb2908e52742248faf0ee993 refs/heads/maint\0 report-status
|
|
|
|
C: 0000
|
|
|
|
C: PACK....
|
|
|
|
|
|
|
|
S: 200 OK
|
|
|
|
S: Content-Type: application/x-git-receive-pack-result
|
|
|
|
S: Cache-Control: no-cache
|
|
|
|
S:
|
|
|
|
S: ....
|
|
|
|
|
2013-11-12 16:17:43 +01:00
|
|
|
Clients MUST NOT reuse or revalidate a cached response.
|
2013-08-21 15:45:13 +02:00
|
|
|
Servers MUST include sufficient Cache-Control headers
|
|
|
|
to prevent caching of the response.
|
|
|
|
|
|
|
|
Servers SHOULD support all capabilities defined here.
|
|
|
|
|
|
|
|
Clients MUST send at least one command in the request body.
|
|
|
|
Within the command portion of the request body clients SHOULD send
|
|
|
|
the id obtained through ref discovery as old_id.
|
|
|
|
|
|
|
|
update_request = command_list
|
|
|
|
"PACK" <binary data>
|
|
|
|
|
|
|
|
command_list = PKT-LINE(command NUL cap_list LF)
|
|
|
|
*(command_pkt)
|
|
|
|
command_pkt = PKT-LINE(command LF)
|
|
|
|
cap_list = *(SP capability) SP
|
|
|
|
|
|
|
|
command = create / delete / update
|
|
|
|
create = zero-id SP new_id SP name
|
|
|
|
delete = old_id SP zero-id SP name
|
|
|
|
update = old_id SP new_id SP name
|
|
|
|
|
|
|
|
TODO: Document this further.
|
|
|
|
|
2022-08-04 18:28:41 +02:00
|
|
|
REFERENCES
|
2013-08-21 15:45:13 +02:00
|
|
|
----------
|
|
|
|
|
Documentation: fix documentation AsciiDoc links for external urls
Turns out that putting 'link:' before the 'http' is actually superfluous
in AsciiDoc, as there's already a predefined macro to handle it.
"http, https, [etc] URLs are rendered using predefined inline macros."
http://www.methods.co.nz/asciidoc/userguide.html#_urls
"Hypertext links to files on the local file system are specified
using the link inline macro."
http://www.methods.co.nz/asciidoc/userguide.html#_linking_to_local_documents
Despite being superfluous, the reference implementation of AsciiDoc
tolerates the extra 'link:' and silently removes it, giving a functioning
link in the generated HTML. However, AsciiDoctor (the Ruby implementation
of AsciiDoc used to render the http://git-scm.com/ site) does /not/ have
this behaviour, and so generates broken links, as can be seen here:
http://git-scm.com/docs/git-cvsimport (links to cvs2git & parsecvs)
http://git-scm.com/docs/git-filter-branch (link to The BFG)
It's worth noting that after this change, the html generated by 'make html'
in the git project is identical, and all links still work.
Signed-off-by: Roberto Tyley <roberto.tyley@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-02-18 22:42:22 +01:00
|
|
|
http://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
|
|
|
|
http://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
|
2022-08-04 18:28:41 +02:00
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
|
2022-08-04 18:28:36 +02:00
|
|
|
linkgit:gitprotocol-pack[5]
|
|
|
|
linkgit:gitprotocol-capabilities[5]
|
2022-08-04 18:28:41 +02:00
|
|
|
|
|
|
|
GIT
|
|
|
|
---
|
|
|
|
Part of the linkgit:git[1] suite
|