@@ -35,6 +35,37 @@ transport protocols, such as 'git-remote-http', 'git-remote-https',
3535'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
3636'fetch', 'option', and 'push'.
3737
38+ INVOCATION
39+ ----------
40+
41+ Remote helper programs are invoked with one or (optionally) two
42+ arguments. The first argument specifies a remote repository as in git;
43+ it is either the name of a configured remote or a URL. The second
44+ argument specifies a URL; it is usually of the form
45+ '<transport>://<address>', but any arbitrary string is possible.
46+ The 'GIT_DIR' environment variable is set up for the remote helper
47+ and can be used to determine where to store additional data or from
48+ which directory to invoke auxiliary git commands.
49+
50+ When git encounters a URL of the form '<transport>://<address>', where
51+ '<transport>' is a protocol that it cannot handle natively, it
52+ automatically invokes 'git remote-<transport>' with the full URL as
53+ the second argument. If such a URL is encountered directly on the
54+ command line, the first argument is the same as the second, and if it
55+ is encountered in a configured remote, the first argument is the name
56+ of that remote.
57+
58+ A URL of the form '<transport>::<address>' explicitly instructs git to
59+ invoke 'git remote-<transport>' with '<address>' as the second
60+ argument. If such a URL is encountered directly on the command line,
61+ the first argument is '<address>', and if it is encountered in a
62+ configured remote, the first argument is the name of that remote.
63+
64+ Additionally, when a configured remote has 'remote.<name>.vcs' set to
65+ '<transport>', git explicitly invokes 'git remote-<transport>' with
66+ '<name>' as the first argument. If set, the second argument is
67+ 'remote.<name>.url'; otherwise, the second argument is omitted.
68+
3869INPUT FORMAT
3970------------
4071
@@ -57,67 +88,17 @@ Each remote helper is expected to support only a subset of commands.
5788The operations a helper supports are declared to git in the response
5889to the `capabilities` command (see COMMANDS, below).
5990
60- 'option'::
61- For specifying settings like `verbosity` (how much output to
62- write to stderr) and `depth` (how much history is wanted in the
63- case of a shallow clone) that affect how other commands are
64- carried out.
65-
66- 'connect'::
67- For fetching and pushing using git's native packfile protocol
68- that requires a bidirectional, full-duplex connection.
69-
70- 'push'::
71- For listing remote refs and pushing specified objects from the
72- local object store to remote refs.
73-
74- 'fetch'::
75- For listing remote refs and fetching the associated history to
76- the local object store.
77-
78- 'import'::
79- For listing remote refs and fetching the associated history as
80- a fast-import stream.
81-
82- 'refspec' <refspec>::
83- This modifies the 'import' capability, allowing the produced
84- fast-import stream to modify refs in a private namespace
85- instead of writing to refs/heads or refs/remotes directly.
86- It is recommended that all importers providing the 'import'
87- capability use this.
88- +
89- A helper advertising the capability
90- `refspec refs/heads/*:refs/svn/origin/branches/*`
91- is saying that, when it is asked to `import refs/heads/topic`, the
92- stream it outputs will update the `refs/svn/origin/branches/topic`
93- ref.
94- +
95- This capability can be advertised multiple times. The first
96- applicable refspec takes precedence. The left-hand of refspecs
97- advertised with this capability must cover all refs reported by
98- the list command. If no 'refspec' capability is advertised,
99- there is an implied `refspec *:*`.
100-
101- 'bidi-import'::
102- The fast-import commands 'cat-blob' and 'ls' can be used by remote-helpers
103- to retrieve information about blobs and trees that already exist in
104- fast-import's memory. This requires a channel from fast-import to the
105- remote-helper.
106- If it is advertised in addition to "import", git establishes a pipe from
107- fast-import to the remote-helper's stdin.
108- It follows that git and fast-import are both connected to the
109- remote-helper's stdin. Because git can send multiple commands to
110- the remote-helper it is required that helpers that use 'bidi-import'
111- buffer all 'import' commands of a batch before sending data to fast-import.
112- This is to prevent mixing commands and fast-import responses on the
113- helper's stdin.
91+ In the following, we list all defined capabilities and for
92+ each we list which commands a helper with that capability
93+ must provide.
11494
11595Capabilities for Pushing
116- ~~~~~~~~~~~~~~~~~~~~~~~~
96+ ^^^^^^^^^^^^^^^^^^^^^^^^
11797'connect'::
11898 Can attempt to connect to 'git receive-pack' (for pushing),
119- 'git upload-pack', etc for communication using the
120- packfile protocol.
99+ 'git upload-pack', etc for communication using
100+ git's native packfile protocol. This
101+ requires a bidirectional, full-duplex connection.
121102+
122103Supported commands: 'connect'.
123104
@@ -127,16 +108,26 @@ Supported commands: 'connect'.
127108+
128109Supported commands: 'list for-push', 'push'.
129110
130- If a helper advertises both 'connect' and 'push', git will use
131- 'connect' if possible and fall back to 'push' if the helper requests
132- so when connecting (see the 'connect' command under COMMANDS).
111+ 'export'::
112+ Can discover remote refs and push specified objects from a
113+ fast-import stream to remote refs.
114+ +
115+ Supported commands: 'list for-push', 'export'.
116+
117+ If a helper advertises 'connect', git will use it if possible and
118+ fall back to another capability if the helper requests so when
119+ connecting (see the 'connect' command under COMMANDS).
120+ When choosing between 'push' and 'export', git prefers 'push'.
121+ Other frontends may have some other order of preference.
122+
133123
134124Capabilities for Fetching
135- ~~~~~~~~~~~~~~~~~~~~~~~~~
125+ ^^^^^^^^^^^^^^^^^^^^^^^^^
136126'connect'::
137127 Can try to connect to 'git upload-pack' (for fetching),
138128 'git receive-pack', etc for communication using the
139- packfile protocol.
129+ git's native packfile protocol. This
130+ requires a bidirectional, full-duplex connection.
140131+
141132Supported commands: 'connect'.
142133
@@ -158,51 +149,61 @@ connecting (see the 'connect' command under COMMANDS).
158149When choosing between 'fetch' and 'import', git prefers 'fetch'.
159150Other frontends may have some other order of preference.
160151
152+ Miscellaneous capabilities
153+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
154+
155+ 'option'::
156+ For specifying settings like `verbosity` (how much output to
157+ write to stderr) and `depth` (how much history is wanted in the
158+ case of a shallow clone) that affect how other commands are
159+ carried out.
160+
161161'refspec' <refspec>::
162- This modifies the 'import' capability.
162+ This modifies the 'import' capability, allowing the produced
163+ fast-import stream to modify refs in a private namespace
164+ instead of writing to refs/heads or refs/remotes directly.
165+ It is recommended that all importers providing the 'import'
166+ capability use this.
163167+
164- A helper advertising
168+ A helper advertising the capability
165169`refspec refs/heads/*:refs/svn/origin/branches/*`
166- in its capabilities is saying that, when it handles
167- `import refs/heads/topic`, the stream it outputs will update the
168- `refs/svn/origin/branches/topic` ref.
170+ is saying that, when it is asked to `import refs/heads/topic`, the
171+ stream it outputs will update the `refs/svn/origin/branches/topic`
172+ ref.
169173+
170174This capability can be advertised multiple times. The first
171175applicable refspec takes precedence. The left-hand of refspecs
172176advertised with this capability must cover all refs reported by
173177the list command. If no 'refspec' capability is advertised,
174178there is an implied `refspec *:*`.
175179
176- INVOCATION
177- ----------
180+ 'bidi-import'::
181+ This modifies the 'import' capability.
182+ The fast-import commands 'cat-blob' and 'ls' can be used by remote-helpers
183+ to retrieve information about blobs and trees that already exist in
184+ fast-import's memory. This requires a channel from fast-import to the
185+ remote-helper.
186+ If it is advertised in addition to "import", git establishes a pipe from
187+ fast-import to the remote-helper's stdin.
188+ It follows that git and fast-import are both connected to the
189+ remote-helper's stdin. Because git can send multiple commands to
190+ the remote-helper it is required that helpers that use 'bidi-import'
191+ buffer all 'import' commands of a batch before sending data to fast-import.
192+ This is to prevent mixing commands and fast-import responses on the
193+ helper's stdin.
178194
179- Remote helper programs are invoked with one or (optionally) two
180- arguments. The first argument specifies a remote repository as in git;
181- it is either the name of a configured remote or a URL. The second
182- argument specifies a URL; it is usually of the form
183- '<transport>://<address>', but any arbitrary string is possible.
184- The 'GIT_DIR' environment variable is set up for the remote helper
185- and can be used to determine where to store additional data or from
186- which directory to invoke auxiliary git commands.
195+ 'export-marks' <file>::
196+ This modifies the 'export' capability, instructing git to dump the
197+ internal marks table to <file> when complete. For details,
198+ read up on '--export-marks=<file>' in linkgit:git-fast-export[1].
199+
200+ 'import-marks' <file>::
201+ This modifies the 'export' capability, instructing git to load the
202+ marks specified in <file> before processing any input. For details,
203+ read up on '--import-marks=<file>' in linkgit:git-fast-export[1].
187204
188- When git encounters a URL of the form '<transport>://<address>', where
189- '<transport>' is a protocol that it cannot handle natively, it
190- automatically invokes 'git remote-<transport>' with the full URL as
191- the second argument. If such a URL is encountered directly on the
192- command line, the first argument is the same as the second, and if it
193- is encountered in a configured remote, the first argument is the name
194- of that remote.
195205
196- A URL of the form '<transport>::<address>' explicitly instructs git to
197- invoke 'git remote-<transport>' with '<address>' as the second
198- argument. If such a URL is encountered directly on the command line,
199- the first argument is '<address>', and if it is encountered in a
200- configured remote, the first argument is the name of that remote.
201206
202- Additionally, when a configured remote has 'remote.<name>.vcs' set to
203- '<transport>', git explicitly invokes 'git remote-<transport>' with
204- '<name>' as the first argument. If set, the second argument is
205- 'remote.<name>.url'; otherwise, the second argument is omitted.
206207
207208COMMANDS
208209--------
@@ -212,9 +213,11 @@ Commands are given by the caller on the helper's standard input, one per line.
212213'capabilities'::
213214 Lists the capabilities of the helper, one per line, ending
214215 with a blank line. Each capability may be preceded with '*',
215- which marks them mandatory for git version using the remote
216- helper to understand (unknown mandatory capability is fatal
217- error).
216+ which marks them mandatory for git versions using the remote
217+ helper to understand. Any unknown mandatory capability is a
218+ fatal error.
219+ +
220+ Support for this command is mandatory.
218221
219222'list'::
220223 Lists the refs, one per line, in the format "<value> <name>
@@ -224,9 +227,20 @@ Commands are given by the caller on the helper's standard input, one per line.
224227 the name; unrecognized attributes are ignored. The list ends
225228 with a blank line.
226229+
227- If 'push' is supported this may be called as 'list for-push'
228- to obtain the current refs prior to sending one or more 'push'
229- commands to the helper.
230+ See REF LIST ATTRIBUTES for a list of currently defined attributes.
231+ +
232+ Supported if the helper has the "fetch" or "import" capability.
233+
234+ 'list for-push'::
235+ Similar to 'list', except that it is used if and only if
236+ the caller wants to the resulting ref list to prepare
237+ push commands.
238+ A helper supporting both push and fetch can use this
239+ to distinguish for which operation the output of 'list'
240+ is going to be used, possibly reducing the amount
241+ of work that needs to be performed.
242+ +
243+ Supported if the helper has the "push" or "export" capability.
230244
231245'option' <name> <value>::
232246 Sets the transport helper option <name> to <value>. Outputs a
@@ -236,6 +250,8 @@ commands to the helper.
236250 for it). Options should be set before other commands,
237251 and may influence the behavior of those commands.
238252+
253+ See OPTIONS for a list of currently defined options.
254+ +
239255Supported if the helper has the "option" capability.
240256
241257'fetch' <sha1> <name>::
@@ -244,7 +260,7 @@ Supported if the helper has the "option" capability.
244260 per line, terminated with a blank line.
245261 Outputs a single blank line when all fetch commands in the
246262 same batch are complete. Only objects which were reported
247- in the ref list with a sha1 may be fetched this way.
263+ in the output of ' list' with a sha1 may be fetched this way.
248264+
249265Optionally may output a 'lock <file>' line indicating a file under
250266GIT_DIR/objects/pack which is keeping a pack until refs can be
@@ -305,7 +321,23 @@ sequence has to be buffered before starting to send data to fast-import
305321to prevent mixing of commands and fast-import responses on the helper's
306322stdin.
307323+
308- Supported if the helper has the 'import' capability.
324+ Supported if the helper has the "import" capability.
325+
326+ 'export'::
327+ Instructs the remote helper that any subsequent input is
328+ part of a fast-import stream (generated by 'git fast-export')
329+ containing objects which should be pushed to the remote.
330+ +
331+ Especially useful for interoperability with a foreign versioning
332+ system.
333+ +
334+ The 'export-marks' and 'import-marks' capabilities, if specified,
335+ affect this command in so far as they are passed on to 'git
336+ fast-export', which then will load/store a table of marks for
337+ local objects. This can be used to implement for incremental
338+ operations.
339+ +
340+ Supported if the helper has the "export" capability.
309341
310342'connect' <service>::
311343 Connects to given service. Standard input and standard output
@@ -332,17 +364,20 @@ capabilities reported by the helper.
332364REF LIST ATTRIBUTES
333365-------------------
334366
335- 'for-push'::
336- The caller wants to use the ref list to prepare push
337- commands. A helper might chose to acquire the ref list by
338- opening a different type of connection to the destination.
367+ The 'list' command produces a list of refs in which each ref
368+ may be followed by a list of attributes. The following ref list
369+ attributes are defined.
339370
340371'unchanged'::
341372 This ref is unchanged since the last import or fetch, although
342373 the helper cannot necessarily determine what value that produced.
343374
344375OPTIONS
345376-------
377+
378+ The following options are defined and (under suitable circumstances)
379+ set by git if the remote helper has the 'option' capability.
380+
346381'option verbosity' <n>::
347382 Changes the verbosity of messages displayed by the helper.
348383 A value of 0 for <n> means that processes operate
0 commit comments