diff options
Diffstat (limited to 'Documentation/gitremote-helpers.txt')
-rw-r--r-- | Documentation/gitremote-helpers.txt | 227 |
1 files changed, 180 insertions, 47 deletions
diff --git a/Documentation/gitremote-helpers.txt b/Documentation/gitremote-helpers.txt index 0f21367ca5..6f1e269ae4 100644 --- a/Documentation/gitremote-helpers.txt +++ b/Documentation/gitremote-helpers.txt @@ -1,4 +1,4 @@ -gitremote-helpers(1) +gitremote-helpers(7) ==================== NAME @@ -14,17 +14,17 @@ DESCRIPTION ----------- Remote helper programs are normally not used directly by end users, -but they are invoked by git when it needs to interact with remote -repositories git does not support natively. A given helper will -implement a subset of the capabilities documented here. When git +but they are invoked by Git when it needs to interact with remote +repositories Git does not support natively. A given helper will +implement a subset of the capabilities documented here. When Git needs to interact with a repository using a remote helper, it spawns the helper as an independent process, sends commands to the helper's standard input, and expects results from the helper's standard 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. +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 +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, @@ -39,15 +39,15 @@ INVOCATION ---------- Remote helper programs are invoked with one or (optionally) two -arguments. The first argument specifies a remote repository as in git; +arguments. The first argument specifies a remote repository as in Git; it is either the name of a configured remote or a URL. The second argument specifies a URL; it is usually of the form '<transport>://<address>', but any arbitrary string is possible. -The 'GIT_DIR' environment variable is set up for the remote helper +The `GIT_DIR` environment variable is set up for the remote helper and can be used to determine where to store additional data or from -which directory to invoke auxiliary git commands. +which directory to invoke auxiliary Git commands. -When git encounters a URL of the form '<transport>://<address>', where +When Git encounters a URL of the form '<transport>://<address>', where '<transport>' is a protocol that it cannot handle natively, it automatically invokes 'git remote-<transport>' with the full URL as the second argument. If such a URL is encountered directly on the @@ -55,16 +55,16 @@ command line, the first argument is the same as the second, and if it is encountered in a configured remote, the first argument is the name of that remote. -A URL of the form '<transport>::<address>' explicitly instructs git to +A URL of the form '<transport>::<address>' explicitly instructs Git to invoke 'git remote-<transport>' with '<address>' as the second argument. If such a URL is encountered directly on the command line, the first argument is '<address>', and if it is encountered in a configured remote, the first argument is the name of that remote. -Additionally, when a configured remote has 'remote.<name>.vcs' set to -'<transport>', git explicitly invokes 'git remote-<transport>' with +Additionally, when a configured remote has `remote.<name>.vcs` set to +'<transport>', Git explicitly invokes 'git remote-<transport>' with '<name>' as the first argument. If set, the second argument is -'remote.<name>.url'; otherwise, the second argument is omitted. +`remote.<name>.url`; otherwise, the second argument is omitted. INPUT FORMAT ------------ @@ -85,7 +85,7 @@ 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 +The operations a helper supports are declared to Git in the response to the `capabilities` command (see COMMANDS, below). In the following, we list all defined capabilities and for @@ -102,6 +102,14 @@ Capabilities for Pushing + Supported commands: 'connect'. +'stateless-connect':: + Experimental; for internal use only. + Can attempt to connect to a remote server for communication + using git's wire-protocol version 2. See the documentation + for the stateless-connect command for more information. ++ +Supported commands: 'stateless-connect'. + 'push':: Can discover remote refs and push local commits and the history leading up to them to new or existing remote refs. @@ -114,23 +122,36 @@ Supported commands: 'list for-push', 'push'. + Supported commands: 'list for-push', 'export'. -If a helper advertises 'connect', git will use it if possible and +If a helper advertises 'connect', Git will use it if possible and fall back to another capability if the helper requests so when connecting (see the 'connect' command under COMMANDS). -When choosing between 'push' and 'export', git prefers 'push'. +When choosing between 'push' and 'export', Git prefers 'push'. Other frontends may have some other order of preference. +'no-private-update':: + When using the 'refspec' capability, git normally updates the + private ref on successful push. This update is disabled when + the remote-helper declares the capability 'no-private-update'. + Capabilities for Fetching ^^^^^^^^^^^^^^^^^^^^^^^^^ 'connect':: Can try to connect to 'git upload-pack' (for fetching), 'git receive-pack', etc for communication using the - git's native packfile protocol. This + Git's native packfile protocol. This requires a bidirectional, full-duplex connection. + Supported commands: 'connect'. +'stateless-connect':: + Experimental; for internal use only. + Can attempt to connect to a remote server for communication + using git's wire-protocol version 2. See the documentation + for the stateless-connect command for more information. ++ +Supported commands: 'stateless-connect'. + 'fetch':: Can discover remote refs and transfer objects reachable from them to the local object store. @@ -143,10 +164,14 @@ Supported commands: 'list', 'fetch'. + Supported commands: 'list', 'import'. -If a helper advertises 'connect', git will use it if possible and +'check-connectivity':: + Can guarantee that when a clone is requested, the received + pack is self contained and is connected. + +If a helper advertises 'connect', Git will use it if possible and fall back to another capability if the helper requests so when connecting (see the 'connect' command under COMMANDS). -When choosing between 'fetch' and 'import', git prefers 'fetch'. +When choosing between 'fetch' and 'import', Git prefers 'fetch'. Other frontends may have some other order of preference. Miscellaneous capabilities @@ -159,11 +184,11 @@ Miscellaneous capabilities carried out. '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. + For remote helpers that implement 'import' or 'export', this capability + allows the refs to be constrained to a private namespace, instead of + writing to refs/heads or refs/remotes directly. It is recommended that all importers providing the 'import' - capability use this. + capability use this. It's mandatory for 'export'. + A helper advertising the capability `refspec refs/heads/*:refs/svn/origin/branches/*` @@ -176,6 +201,12 @@ applicable refspec takes precedence. The left-hand of refspecs advertised with this capability must cover all refs reported by the list command. If no 'refspec' capability is advertised, there is an implied `refspec *:*`. ++ +When writing remote-helpers for decentralized version control +systems, it is advised to keep a local copy of the repository to +interact with, and to let the private namespace refs point to this +local repository, while the refs/remotes namespace is used to track +the remote repository. 'bidi-import':: This modifies the 'import' capability. @@ -183,26 +214,33 @@ there is an implied `refspec *:*`. to retrieve information about blobs and trees that already exist in fast-import's memory. This requires a channel from fast-import to the remote-helper. - If it is advertised in addition to "import", git establishes a pipe from + If it is advertised in addition to "import", Git establishes a pipe from fast-import to the remote-helper's stdin. - It follows that git and fast-import are both connected to the - remote-helper's stdin. Because git can send multiple commands to + It follows that Git and fast-import are both connected to the + remote-helper's stdin. Because Git can send multiple commands to the remote-helper it is required that helpers that use 'bidi-import' buffer all 'import' commands of a batch before sending data to fast-import. This is to prevent mixing commands and fast-import responses on the helper's stdin. 'export-marks' <file>:: - This modifies the 'export' capability, instructing git to dump the + This modifies the 'export' capability, instructing Git to dump the internal marks table to <file> when complete. For details, - read up on '--export-marks=<file>' in linkgit:git-fast-export[1]. + read up on `--export-marks=<file>` in linkgit:git-fast-export[1]. 'import-marks' <file>:: - This modifies the 'export' capability, instructing git to load the + This modifies the 'export' capability, instructing Git to load the marks specified in <file> before processing any input. For details, - read up on '--import-marks=<file>' in linkgit:git-fast-export[1]. + read up on `--import-marks=<file>` in linkgit:git-fast-export[1]. +'signed-tags':: + This modifies the 'export' capability, instructing Git to pass + `--signed-tags=verbatim` to linkgit:git-fast-export[1]. In the + absence of this capability, Git will use `--signed-tags=warn-strip`. +'object-format':: + This indicates that the helper is able to interact with the remote + side using an explicit hash algorithm extension. COMMANDS @@ -213,7 +251,7 @@ Commands are given by the caller on the helper's standard input, one per line. 'capabilities':: Lists the capabilities of the helper, one per line, ending with a blank line. Each capability may be preceded with '*', - which marks them mandatory for git versions using the remote + which marks them mandatory for Git versions using the remote helper to understand. Any unknown mandatory capability is a fatal error. + @@ -222,12 +260,14 @@ Support for this command is mandatory. 'list':: Lists the refs, one per line, in the format "<value> <name> [<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for - a symref, or "?" to indicate that the helper could not get the - value of the ref. A space-separated list of attributes follows - the name; unrecognized attributes are ignored. The list ends - with a blank line. + a symref, ":<keyword> <value>" for a key-value pair, or + "?" to indicate that the helper could not get the value of the + ref. A space-separated list of attributes follows the name; + unrecognized attributes are ignored. The list ends with a + blank line. + See REF LIST ATTRIBUTES for a list of currently defined attributes. +See REF LIST KEYWORDS for a list of currently defined keywords. + Supported if the helper has the "fetch" or "import" capability. @@ -262,9 +302,16 @@ Supported if the helper has the "option" capability. same batch are complete. Only objects which were reported in the output of 'list' with a sha1 may be fetched this way. + -Optionally may output a 'lock <file>' line indicating a file under -GIT_DIR/objects/pack which is keeping a pack until refs can be -suitably updated. +Optionally may output a 'lock <file>' line indicating the full path of +a file under `$GIT_DIR/objects/pack` which is keeping a pack until +refs can be suitably updated. The path must end with `.keep`. This is +a mechanism to name a <pack,idx,keep> tuple by giving only the keep +component. The kept pack will not be deleted by a concurrent repack, +even though its objects may not be referenced until the fetch completes. +The `.keep` file will be deleted at the conclusion of the fetch. ++ +If option 'check-connectivity' is requested, the helper must output +'connectivity-ok' if the clone is self-contained and connected. + Supported if the helper has the "fetch" capability. @@ -276,7 +323,7 @@ Supported if the helper has the "fetch" capability. is followed by a blank line). For example, the following would be two batches of 'push', the first asking the remote-helper to push the local ref 'master' to the remote ref 'master' and - the local 'HEAD' to the remote 'branch', and the second + the local `HEAD` to the remote 'branch', and the second asking to push ref 'foo' to ref 'bar' (forced update requested by the '+'). + @@ -353,6 +400,24 @@ Supported if the helper has the "export" capability. + Supported if the helper has the "connect" capability. +'stateless-connect' <service>:: + Experimental; for internal use only. + Connects to the given remote service for communication using + git's wire-protocol version 2. Valid replies to this command + are empty line (connection established), 'fallback' (no smart + transport support, fall back to dumb transports) and just + exiting with error message printed (can't connect, don't bother + trying to fall back). After line feed terminating the positive + (empty) response, the output of the service starts. Messages + (both request and response) must consist of zero or more + PKT-LINEs, terminating in a flush packet. Response messages will + then have a response end packet after the flush packet to + indicate the end of a response. The client must not + expect the server to store any state in between request-response + pairs. After the connection ends, the remote helper exits. ++ +Supported if the helper has the "stateless-connect" capability. + If a fatal error occurs, the program writes the error message to stderr and exits. The caller should expect that a suitable error message has been printed if the child closes the connection without @@ -372,11 +437,23 @@ attributes are defined. This ref is unchanged since the last import or fetch, although the helper cannot necessarily determine what value that produced. +REF LIST KEYWORDS +----------------- + +The 'list' command may produce a list of key-value pairs. +The following keys are defined. + +'object-format':: + The refs are using the given hash algorithm. This keyword is only + used if the server and client both support the object-format + extension. + + OPTIONS ------- The following options are defined and (under suitable circumstances) -set by git if the remote helper has the 'option' capability. +set by Git if the remote helper has the 'option' capability. 'option verbosity' <n>:: Changes the verbosity of messages displayed by the helper. @@ -386,14 +463,25 @@ set by git if the remote helper has the 'option' capability. of <n> correspond to the number of -v flags passed on the command line. -'option progress' \{'true'|'false'\}:: +'option progress' {'true'|'false'}:: Enables (or disables) progress messages displayed by the transport helper during a command. 'option depth' <depth>:: Deepens the history of a shallow repository. -'option followtags' \{'true'|'false'\}:: +'option deepen-since <timestamp>:: + Deepens the history of a shallow repository based on time. + +'option deepen-not <ref>:: + Deepens the history of a shallow repository excluding ref. + Multiple options add up. + +'option deepen-relative {'true'|'false'}:: + Deepens the history of a shallow repository relative to + current boundary. Only valid when used with "option depth". + +'option followtags' {'true'|'false'}:: If enabled the helper should automatically fetch annotated tag objects if the object the tag points at was transferred during the fetch command. If the tag is not fetched by @@ -401,9 +489,9 @@ set by git if the remote helper has the 'option' capability. ask for the tag specifically. Some helpers may be able to use this option to avoid a second network connection. -'option dry-run' \{'true'|'false'\}: +'option dry-run' {'true'|'false'}: If true, pretend the operation completed successfully, - but don't actually change any repository data. For most + but don't actually change any repository data. For most helpers this only applies to the 'push', if supported. 'option servpath <c-style-quoted-path>':: @@ -412,11 +500,56 @@ set by git if the remote helper has the 'option' capability. must not rely on this option being set before connect request occurs. +'option check-connectivity' {'true'|'false'}:: + Request the helper to check connectivity of a clone. + +'option force' {'true'|'false'}:: + Request the helper to perform a force update. Defaults to + 'false'. + +'option cloning' {'true'|'false'}:: + Notify the helper this is a clone request (i.e. the current + repository is guaranteed empty). + +'option update-shallow' {'true'|'false'}:: + Allow to extend .git/shallow if the new refs require it. + +'option pushcert' {'true'|'false'}:: + GPG sign pushes. + +'option push-option <string>:: + Transmit <string> as a push option. As the push option + must not contain LF or NUL characters, the string is not encoded. + +'option from-promisor' {'true'|'false'}:: + Indicate that these objects are being fetched from a promisor. + +'option no-dependents' {'true'|'false'}:: + Indicate that only the objects wanted need to be fetched, not + their dependents. + +'option atomic' {'true'|'false'}:: + When pushing, request the remote server to update refs in a single atomic + transaction. If successful, all refs will be updated, or none will. If the + remote side does not support this capability, the push will fail. + +'option object-format' {'true'|algorithm}:: + If 'true', indicate that the caller wants hash algorithm information + to be passed back from the remote. This mode is used when fetching + refs. ++ +If set to an algorithm, indicate that the caller wants to interact with +the remote side using that algorithm. + SEE ALSO -------- linkgit:git-remote[1] -linkgit:git-remote-testgit[1] +linkgit:git-remote-ext[1] + +linkgit:git-remote-fd[1] + +linkgit:git-fast-import[1] GIT --- |