Skip to content

Commit 407a963

Browse files
committed
Merge branch 'rr/remote-helper-doc'
* rr/remote-helper-doc: Documentation/remote-helpers: Fix typos and improve language Fixup: Second argument may be any arbitrary string Documentation/remote-helpers: Add invocation section Documentation/urls: Rewrite to accomodate <transport>::<address> Documentation/remote-helpers: Rewrite description
2 parents c4df50c + d43427d commit 407a963

File tree

2 files changed

+119
-58
lines changed

2 files changed

+119
-58
lines changed

Documentation/git-remote-helpers.txt

Lines changed: 83 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,69 @@ git-remote-helpers(1)
33

44
NAME
55
----
6-
git-remote-helpers - Helper programs for interoperation with remote git
6+
git-remote-helpers - Helper programs to interact with remote repositories
77

88
SYNOPSIS
99
--------
10-
'git remote-<transport>' <remote>
10+
'git remote-<transport>' <repository> [<URL>]
1111

1212
DESCRIPTION
1313
-----------
1414

15-
These programs are normally not used directly by end users, but are
16-
invoked by various git programs that interact with remote repositories
17-
when the repository they would operate on will be accessed using
18-
transport code not linked into the main git binary. Various particular
19-
helper programs will behave as documented here.
15+
Remote helper programs are normally not used directly by end users,
16+
but they are invoked by git when it needs to interact with remote
17+
repositories git does not support natively. A given helper will
18+
implement a subset of the capabilities documented here. When git
19+
needs to interact with a repository using a remote helper, it spawns
20+
the helper as an independent process, sends commands to the helper's
21+
standard input, and expects results from the helper's standard
22+
output. Because a remote helper runs as an independent process from
23+
git, there is no need to re-link git to add a new helper, nor any
24+
need to link the helper with the implementation of git.
25+
26+
Every helper must support the "capabilities" command, which git will
27+
use to determine what other commands the helper will accept. Other
28+
commands generally concern facilities like discovering and updating
29+
remote refs, transporting objects between the object database and
30+
the remote repository, and updating the local object store.
31+
32+
Helpers supporting the 'fetch' capability can discover refs from the
33+
remote repository and transfer objects reachable from those refs to
34+
the local object store. Helpers supporting the 'push' capability can
35+
transfer local objects to the remote repository and update remote refs.
36+
37+
Git comes with a "curl" family of remote helpers, that handle various
38+
transport protocols, such as 'git-remote-http', 'git-remote-https',
39+
'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
40+
'fetch', 'option', and 'push'.
41+
42+
INVOCATION
43+
----------
44+
45+
Remote helper programs are invoked with one or (optionally) two
46+
arguments. The first argument specifies a remote repository as in git;
47+
it is either the name of a configured remote or a URL. The second
48+
argument specifies a URL; it is usually of the form
49+
'<transport>://<address>', but any arbitrary string is possible.
50+
51+
When git encounters a URL of the form '<transport>://<address>', where
52+
'<transport>' is a protocol that it cannot handle natively, it
53+
automatically invokes 'git remote-<transport>' with the full URL as
54+
the second argument. If such a URL is encountered directly on the
55+
command line, the first argument is the same as the second, and if it
56+
is encountered in a configured remote, the first argument is the name
57+
of that remote.
58+
59+
A URL of the form '<transport>::<address>' explicitly instructs git to
60+
invoke 'git remote-<transport>' with '<address>' as the second
61+
argument. If such a URL is encountered directly on the command line,
62+
the first argument is '<address>', and if it is encountered in a
63+
configured remote, the first argument is the name of that remote.
64+
65+
Additionally, when a configured remote has 'remote.<name>.vcs' set to
66+
'<transport>', git explicitly invokes 'git remote-<transport>' with
67+
'<name>' as the first argument. If set, the second argument is
68+
'remote.<name>.url'; otherwise, the second argument is omitted.
2069

2170
COMMANDS
2271
--------
@@ -25,8 +74,8 @@ Commands are given by the caller on the helper's standard input, one per line.
2574

2675
'capabilities'::
2776
Lists the capabilities of the helper, one per line, ending
28-
with a blank line. Each capability may be preceded with '*'.
29-
This marks them mandatory for git version using the remote
77+
with a blank line. Each capability may be preceded with '*',
78+
which marks them mandatory for git version using the remote
3079
helper to understand (unknown mandatory capability is fatal
3180
error).
3281

@@ -35,27 +84,27 @@ Commands are given by the caller on the helper's standard input, one per line.
3584
[<attr> ...]". The value may be a hex sha1 hash, "@<dest>" for
3685
a symref, or "?" to indicate that the helper could not get the
3786
value of the ref. A space-separated list of attributes follows
38-
the name; unrecognized attributes are ignored. After the
39-
complete list, outputs a blank line.
87+
the name; unrecognized attributes are ignored. The list ends
88+
with a blank line.
4089
+
4190
If 'push' is supported this may be called as 'list for-push'
4291
to obtain the current refs prior to sending one or more 'push'
4392
commands to the helper.
4493

4594
'option' <name> <value>::
46-
Set the transport helper option <name> to <value>. Outputs a
95+
Sets the transport helper option <name> to <value>. Outputs a
4796
single line containing one of 'ok' (option successfully set),
4897
'unsupported' (option not recognized) or 'error <msg>'
49-
(option <name> is supported but <value> is not correct
98+
(option <name> is supported but <value> is not valid
5099
for it). Options should be set before other commands,
51-
and may how those commands behave.
100+
and may influence the behavior of those commands.
52101
+
53102
Supported if the helper has the "option" capability.
54103

55104
'fetch' <sha1> <name>::
56105
Fetches the given object, writing the necessary objects
57106
to the database. Fetch commands are sent in a batch, one
58-
per line, and the batch is terminated with a blank line.
107+
per line, terminated with a blank line.
59108
Outputs a single blank line when all fetch commands in the
60109
same batch are complete. Only objects which were reported
61110
in the ref list with a sha1 may be fetched this way.
@@ -67,7 +116,7 @@ suitably updated.
67116
Supported if the helper has the "fetch" capability.
68117

69118
'push' +<src>:<dst>::
70-
Pushes the given <src> commit or branch locally to the
119+
Pushes the given local <src> commit or branch to the
71120
remote branch described by <dst>. A batch sequence of
72121
one or more push commands is terminated with a blank line.
73122
+
@@ -91,6 +140,9 @@ Supported if the helper has the "push" capability.
91140
by applying the refspecs from the "refspec" capability to the
92141
name of the ref.
93142
+
143+
Especially useful for interoperability with a foreign versioning
144+
system.
145+
+
94146
Supported if the helper has the "import" capability.
95147

96148
'connect' <service>::
@@ -119,16 +171,11 @@ CAPABILITIES
119171
------------
120172

121173
'fetch'::
122-
This helper supports the 'fetch' command.
123-
124174
'option'::
125-
This helper supports the option command.
126-
127175
'push'::
128-
This helper supports the 'push' command.
129-
130176
'import'::
131-
This helper supports the 'import' command.
177+
'connect'::
178+
This helper supports the corresponding command with the same name.
132179

133180
'refspec' 'spec'::
134181
When using the import command, expect the source ref to have
@@ -140,9 +187,6 @@ CAPABILITIES
140187
all, it must cover all refs reported by the list command; if
141188
it is not used, it is effectively "*:*"
142189

143-
'connect'::
144-
This helper supports the 'connect' command.
145-
146190
REF LIST ATTRIBUTES
147191
-------------------
148192

@@ -158,19 +202,19 @@ REF LIST ATTRIBUTES
158202
OPTIONS
159203
-------
160204
'option verbosity' <N>::
161-
Change the level of messages displayed by the helper.
162-
When N is 0 the end-user has asked the process to be
163-
quiet, and the helper should produce only error output.
164-
N of 1 is the default level of verbosity, higher values
205+
Changes the verbosity of messages displayed by the helper.
206+
A value of 0 for N means that processes operate
207+
quietly, and the helper produces only error output.
208+
1 is the default level of verbosity, and higher values
165209
of N correspond to the number of -v flags passed on the
166210
command line.
167211

168212
'option progress' \{'true'|'false'\}::
169-
Enable (or disable) progress messages displayed by the
213+
Enables (or disables) progress messages displayed by the
170214
transport helper during a command.
171215

172216
'option depth' <depth>::
173-
Deepen the history of a shallow repository.
217+
Deepens the history of a shallow repository.
174218

175219
'option followtags' \{'true'|'false'\}::
176220
If enabled the helper should automatically fetch annotated
@@ -186,11 +230,15 @@ OPTIONS
186230
helpers this only applies to the 'push', if supported.
187231

188232
'option servpath <c-style-quoted-path>'::
189-
Set service path (--upload-pack, --receive-pack etc.) for
190-
next connect. Remote helper MAY support this option. Remote
191-
helper MUST NOT rely on this option being set before
233+
Sets service path (--upload-pack, --receive-pack etc.) for
234+
next connect. Remote helper may support this option, but
235+
must not rely on this option being set before
192236
connect request occurs.
193237

238+
SEE ALSO
239+
--------
240+
linkgit:git-remote[1]
241+
194242
Documentation
195243
-------------
196244
Documentation by Daniel Barkalow and Ilari Liusvaara

Documentation/urls.txt

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,57 @@
11
GIT URLS[[URLS]]
22
----------------
33

4-
One of the following notations can be used
5-
to name the remote repository:
4+
In general, URLs contain information about the transport protocol, the
5+
address of the remote server, and the path to the repository.
6+
Depending on the transport protocol, some of this information may be
7+
absent.
8+
9+
Git natively supports ssh, git, http, https, ftp, ftps, and rsync
10+
protocols. The following syntaxes may be used with them:
611

7-
- rsync://host.xz/path/to/repo.git/
8-
- http://host.xz{startsb}:port{endsb}/path/to/repo.git/
9-
- https://host.xz{startsb}:port{endsb}/path/to/repo.git/
10-
- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
11-
- git://host.xz{startsb}:port{endsb}/~user/path/to/repo.git/
1212
- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/path/to/repo.git/
13-
- ssh://{startsb}user@{endsb}host.xz/path/to/repo.git/
14-
- ssh://{startsb}user@{endsb}host.xz/~user/path/to/repo.git/
15-
- ssh://{startsb}user@{endsb}host.xz/~/path/to/repo.git
13+
- git://host.xz{startsb}:port{endsb}/path/to/repo.git/
14+
- http{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
15+
- ftp{startsb}s{endsb}://host.xz{startsb}:port{endsb}/path/to/repo.git/
16+
- rsync://host.xz/path/to/repo.git/
1617

17-
SSH is the default transport protocol over the network. You can
18-
optionally specify which user to log-in as, and an alternate,
19-
scp-like syntax is also supported. Both syntaxes support
20-
username expansion, as does the native git protocol, but
21-
only the former supports port specification. The following
22-
three are identical to the last three above, respectively:
18+
An alternative scp-like syntax may also be used with the ssh protocol:
2319

24-
- {startsb}user@{endsb}host.xz:/path/to/repo.git/
25-
- {startsb}user@{endsb}host.xz:~user/path/to/repo.git/
26-
- {startsb}user@{endsb}host.xz:path/to/repo.git
20+
- {startsb}user@{endsb}host.xz:path/to/repo.git/
2721

28-
To sync with a local directory, you can use:
22+
The ssh and git protocols additionally support ~username expansion:
23+
24+
- ssh://{startsb}user@{endsb}host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
25+
- git://host.xz{startsb}:port{endsb}/~{startsb}user{endsb}/path/to/repo.git/
26+
- {startsb}user@{endsb}host.xz:/~{startsb}user{endsb}/path/to/repo.git/
27+
28+
For local respositories, also supported by git natively, the following
29+
syntaxes may be used:
2930

3031
- /path/to/repo.git/
3132
- file:///path/to/repo.git/
3233

3334
ifndef::git-clone[]
34-
They are mostly equivalent, except when cloning. See
35-
linkgit:git-clone[1] for details.
35+
These two syntaxes are mostly equivalent, except when cloning, when
36+
the former implies --local option. See linkgit:git-clone[1] for
37+
details.
3638
endif::git-clone[]
3739

3840
ifdef::git-clone[]
39-
They are equivalent, except the former implies --local option.
41+
These two syntaxes are mostly equivalent, except the former implies
42+
--local option.
4043
endif::git-clone[]
4144

45+
When git doesn't know how to handle a certain transport protocol, it
46+
attempts to use the 'remote-<transport>' remote helper, if one
47+
exists. To explicitly request a remote helper, the following syntax
48+
may be used:
49+
50+
- <transport>::<address>
51+
52+
where <address> may be a path, a server and path, or an arbitrary
53+
URL-like string recognized by the specific remote helper being
54+
invoked. See linkgit:git-remote-helpers[1] for details.
4255

4356
If there are a large number of similarly-named remote repositories and
4457
you want to use a different format for them (such that the URLs you

0 commit comments

Comments
 (0)