@@ -35,6 +35,37 @@ transport protocols, such as 'git-remote-http', 'git-remote-https',
35
35
'git-remote-ftp' and 'git-remote-ftps'. They implement the capabilities
36
36
'fetch', 'option', and 'push'.
37
37
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
+
38
69
INPUT FORMAT
39
70
------------
40
71
@@ -57,67 +88,17 @@ Each remote helper is expected to support only a subset of commands.
57
88
The operations a helper supports are declared to git in the response
58
89
to the `capabilities` command (see COMMANDS, below).
59
90
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.
114
94
115
95
Capabilities for Pushing
116
- ~~~~~~~~~~~~~~~~~~~~~~~~
96
+ ^^^^^^^^^^^^^^^^^^^^^^^^
117
97
'connect'::
118
98
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.
121
102
+
122
103
Supported commands: 'connect'.
123
104
@@ -127,16 +108,26 @@ Supported commands: 'connect'.
127
108
+
128
109
Supported commands: 'list for-push', 'push'.
129
110
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
+
133
123
134
124
Capabilities for Fetching
135
- ~~~~~~~~~~~~~~~~~~~~~~~~~
125
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
136
126
'connect'::
137
127
Can try to connect to 'git upload-pack' (for fetching),
138
128
'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.
140
131
+
141
132
Supported commands: 'connect'.
142
133
@@ -158,51 +149,61 @@ connecting (see the 'connect' command under COMMANDS).
158
149
When choosing between 'fetch' and 'import', git prefers 'fetch'.
159
150
Other frontends may have some other order of preference.
160
151
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
+
161
161
'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.
163
167
+
164
- A helper advertising
168
+ A helper advertising the capability
165
169
`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.
169
173
+
170
174
This capability can be advertised multiple times. The first
171
175
applicable refspec takes precedence. The left-hand of refspecs
172
176
advertised with this capability must cover all refs reported by
173
177
the list command. If no 'refspec' capability is advertised,
174
178
there is an implied `refspec *:*`.
175
179
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.
178
194
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].
187
204
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.
195
205
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.
201
206
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.
206
207
207
208
COMMANDS
208
209
--------
@@ -212,9 +213,11 @@ Commands are given by the caller on the helper's standard input, one per line.
212
213
'capabilities'::
213
214
Lists the capabilities of the helper, one per line, ending
214
215
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.
218
221
219
222
'list'::
220
223
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.
224
227
the name; unrecognized attributes are ignored. The list ends
225
228
with a blank line.
226
229
+
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.
230
244
231
245
'option' <name> <value>::
232
246
Sets the transport helper option <name> to <value>. Outputs a
@@ -236,6 +250,8 @@ commands to the helper.
236
250
for it). Options should be set before other commands,
237
251
and may influence the behavior of those commands.
238
252
+
253
+ See OPTIONS for a list of currently defined options.
254
+ +
239
255
Supported if the helper has the "option" capability.
240
256
241
257
'fetch' <sha1> <name>::
@@ -244,7 +260,7 @@ Supported if the helper has the "option" capability.
244
260
per line, terminated with a blank line.
245
261
Outputs a single blank line when all fetch commands in the
246
262
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.
248
264
+
249
265
Optionally may output a 'lock <file>' line indicating a file under
250
266
GIT_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
305
321
to prevent mixing of commands and fast-import responses on the helper's
306
322
stdin.
307
323
+
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.
309
341
310
342
'connect' <service>::
311
343
Connects to given service. Standard input and standard output
@@ -332,17 +364,20 @@ capabilities reported by the helper.
332
364
REF LIST ATTRIBUTES
333
365
-------------------
334
366
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.
339
370
340
371
'unchanged'::
341
372
This ref is unchanged since the last import or fetch, although
342
373
the helper cannot necessarily determine what value that produced.
343
374
344
375
OPTIONS
345
376
-------
377
+
378
+ The following options are defined and (under suitable circumstances)
379
+ set by git if the remote helper has the 'option' capability.
380
+
346
381
'option verbosity' <n>::
347
382
Changes the verbosity of messages displayed by the helper.
348
383
A value of 0 for <n> means that processes operate
0 commit comments