Documentation/remote-helpers: explain capabilities first
The current remote helper documentation is from the perspective of
git, so to speak: it presents a full menu of commands for a person
invoking a remote helper to choose from. In practice, that's less
useful than it could be, since the daunted novice remote-helper author
probably just wanted a list of commands needs to implement to get
started. So preface the command list with an overview of each
capability, its purpose, and what commands it requires.
As a side effect, this makes it a little clearer that git doesn't
choose arbitrary commands to run, even if the remote helper advertises
all capabilities --- instead, there are well defined command sequences
for various tasks.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder13 years agocommitted byJunio C Hamano
@ -24,22 +24,141 @@ output. Because a remote helper runs as an independent process from
@@ -24,22 +24,141 @@ output. Because a remote helper runs as an independent process from
git, there is no need to re-link git to add a new helper, nor any
need to link the helper with the implementation of git.
Every helper must support the "capabilities" command, which git will
use to determine what other commands the helper will accept. Other
commands generally concern facilities like discovering and updating
remote refs, transporting objects between the object database and
the remote repository, and updating the local object store.
Helpers supporting the 'fetch' capability can discover refs from the
remote repository and transfer objects reachable from those refs to
the local object store. Helpers supporting the 'push' capability can
transfer local objects to the remote repository and update remote refs.
Every helper must support the "capabilities" command, which git
uses to determine what other commands the helper will accept. Those
other commands can be used to discover and update remote refs,
transport objects between the object database and the remote repository,
and update the local object store.
Git comes with a "curl" family of remote helpers, that handle various
transport protocols, such as 'git-remote-http', 'git-remote-https',
'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
'fetch', 'option', and 'push'.
INPUT FORMAT
------------
Git sends the remote helper a list of commands on standard input, one
per line. The first command is always the 'capabilities' command, in
response to which the remote helper must print a list of the
capabilities it supports (see below) followed by a blank line. The
response to the capabilities command determines what commands Git uses
in the remainder of the command stream.
The command stream is terminated by a blank line. In some cases
(indicated in the documentation of the relevant commands), this blank
line is followed by a payload in some other protocol (e.g., the pack
protocol), while in others it indicates the end of input.
Capabilities
~~~~~~~~~~~~
Each remote helper is expected to support only a subset of commands.
The operations a helper supports are declared to git in the response
to the `capabilities` command (see COMMANDS, below).
'option'::
For specifying settings like `verbosity` (how much output to
write to stderr) and `depth` (how much history is wanted in the
case of a shallow clone) that affect how other commands are
carried out.
'connect'::
For fetching and pushing using git's native packfile protocol
that requires a bidirectional, full-duplex connection.
'push'::
For listing remote refs and pushing specified objects from the
local object store to remote refs.
'fetch'::
For listing remote refs and fetching the associated history to
the local object store.
'import'::
For listing remote refs and fetching the associated history as
a fast-import stream.
'refspec' <refspec>::
This modifies the 'import' capability, allowing the produced
fast-import stream to modify refs in a private namespace
instead of writing to refs/heads or refs/remotes directly.
It is recommended that all importers providing the 'import'