9
9
--------
10
10
[verse]
11
11
'git interpret-trailers' [--in-place] [--trim-empty]
12
- [(--trailer <token> [(=|:)<value>])...]
12
+ [(--trailer (<key>|<keyAlias>) [(=|:)<value>])...]
13
13
[--parse] [<file>...]
14
14
15
15
DESCRIPTION
@@ -53,22 +53,32 @@ are applied to each input and the way any existing trailer in
53
53
the input is changed. They also make it possible to
54
54
automatically add some trailers.
55
55
56
- By default, a '<token >=<value>' or '<token >:<value>' argument given
56
+ By default, a '<key >=<value>' or '<key >:<value>' argument given
57
57
using `--trailer` will be appended after the existing trailers only if
58
- the last trailer has a different (<token >, <value>) pair (or if there
59
- is no existing trailer). The <token > and <value> parts will be trimmed
58
+ the last trailer has a different (<key >, <value>) pair (or if there
59
+ is no existing trailer). The <key > and <value> parts will be trimmed
60
60
to remove starting and trailing whitespace, and the resulting trimmed
61
- <token > and <value> will appear in the output like this:
61
+ <key > and <value> will appear in the output like this:
62
62
63
63
------------------------------------------------
64
- token : value
64
+ key : value
65
65
------------------------------------------------
66
66
67
- This means that the trimmed <token> and <value> will be separated by
68
- `': '` (one colon followed by one space). For convenience, the <token> can be a
69
- shortened string key (e.g., "sign") instead of the full string which should
70
- appear before the separator on the output (e.g., "Signed-off-by"). This can be
71
- configured using the 'trailer.<token>.key' configuration variable.
67
+ This means that the trimmed <key> and <value> will be separated by
68
+ `': '` (one colon followed by one space).
69
+
70
+ For convenience, a <keyAlias> can be configured to make using `--trailer`
71
+ shorter to type on the command line. This can be configured using the
72
+ 'trailer.<keyAlias>.key' configuration variable. The <keyAlias> must be a prefix
73
+ of the full <key> string, although case sensitivity does not matter. For
74
+ example, if you have
75
+
76
+ ------------------------------------------------
77
+ trailer.sign.key "Signed-off-by: "
78
+ ------------------------------------------------
79
+
80
+ in your configuration, you only need to specify `--trailer="sign: foo"`
81
+ on the command line instead of `--trailer="Signed-off-by: foo"`.
72
82
73
83
By default the new trailer will appear at the end of all the existing
74
84
trailers. If there is no existing trailer, the new trailer will appear
@@ -85,14 +95,14 @@ non-whitespace lines before a line that starts with '---' (followed by a
85
95
space or the end of the line).
86
96
87
97
When reading trailers, there can be no whitespace before or inside the
88
- <token >, but any number of regular space and tab characters are allowed
89
- between the <token > and the separator. There can be whitespaces before,
98
+ <key >, but any number of regular space and tab characters are allowed
99
+ between the <key > and the separator. There can be whitespaces before,
90
100
inside or after the <value>. The <value> may be split over multiple lines
91
101
with each subsequent line starting with at least one whitespace, like
92
102
the "folding" in RFC 822. Example:
93
103
94
104
------------------------------------------------
95
- token : This is a very long value, with spaces and
105
+ key : This is a very long value, with spaces and
96
106
newlines in it.
97
107
------------------------------------------------
98
108
@@ -109,16 +119,16 @@ OPTIONS
109
119
the whole trailer will be removed from the output.
110
120
This applies to existing trailers as well as new trailers.
111
121
112
- --trailer <token >[(=|:)<value>]::
113
- Specify a (<token >, <value>) pair that should be applied as a
122
+ --trailer <key >[(=|:)<value>]::
123
+ Specify a (<key >, <value>) pair that should be applied as a
114
124
trailer to the inputs. See the description of this
115
125
command.
116
126
117
127
--where <placement>::
118
128
--no-where::
119
129
Specify where all new trailers will be added. A setting
120
130
provided with '--where' overrides the `trailer.where` and any
121
- applicable `trailer.<token >.where` configuration variables
131
+ applicable `trailer.<keyAlias >.where` configuration variables
122
132
and applies to all '--trailer' options until the next occurrence of
123
133
'--where' or '--no-where'. Upon encountering '--no-where', clear the
124
134
effect of any previous use of '--where', such that the relevant configuration
@@ -128,9 +138,9 @@ OPTIONS
128
138
--if-exists <action>::
129
139
--no-if-exists::
130
140
Specify what action will be performed when there is already at
131
- least one trailer with the same <token > in the input. A setting
141
+ least one trailer with the same <key > in the input. A setting
132
142
provided with '--if-exists' overrides the `trailer.ifExists` and any
133
- applicable `trailer.<token >.ifExists` configuration variables
143
+ applicable `trailer.<keyAlias >.ifExists` configuration variables
134
144
and applies to all '--trailer' options until the next occurrence of
135
145
'--if-exists' or '--no-if-exists'. Upon encountering '--no-if-exists, clear the
136
146
effect of any previous use of '--if-exists, such that the relevant configuration
@@ -140,9 +150,9 @@ OPTIONS
140
150
--if-missing <action>::
141
151
--no-if-missing::
142
152
Specify what action will be performed when there is no other
143
- trailer with the same <token > in the input. A setting
153
+ trailer with the same <key > in the input. A setting
144
154
provided with '--if-missing' overrides the `trailer.ifMissing` and any
145
- applicable `trailer.<token >.ifMissing` configuration variables
155
+ applicable `trailer.<keyAlias >.ifMissing` configuration variables
146
156
and applies to all '--trailer' options until the next occurrence of
147
157
'--if-missing' or '--no-if-missing'. Upon encountering '--no-if-missing,
148
158
clear the effect of any previous use of '--if-missing, such that the relevant
@@ -187,11 +197,11 @@ used when another separator is not specified in the config for this
187
197
trailer.
188
198
+
189
199
For example, if the value for this option is "%=$", then only lines
190
- using the format '<token ><sep><value>' with <sep> containing '%', '='
200
+ using the format '<key ><sep><value>' with <sep> containing '%', '='
191
201
or '$' and then spaces will be considered trailers. And '%' will be
192
202
the default separator used, so by default trailers will appear like:
193
- '<token >% <value>' (one percent sign and one space will appear between
194
- the token and the value).
203
+ '<key >% <value>' (one percent sign and one space will appear between
204
+ the key and the value).
195
205
196
206
trailer.where::
197
207
This option tells where a new trailer will be added.
@@ -205,41 +215,41 @@ If it is `start`, then each new trailer will appear at the start,
205
215
instead of the end, of the existing trailers.
206
216
+
207
217
If it is `after`, then each new trailer will appear just after the
208
- last trailer with the same <token >.
218
+ last trailer with the same <key >.
209
219
+
210
220
If it is `before`, then each new trailer will appear just before the
211
- first trailer with the same <token >.
221
+ first trailer with the same <key >.
212
222
213
223
trailer.ifexists::
214
224
This option makes it possible to choose what action will be
215
225
performed when there is already at least one trailer with the
216
- same <token > in the input.
226
+ same <key > in the input.
217
227
+
218
228
The valid values for this option are: `addIfDifferentNeighbor` (this
219
229
is the default), `addIfDifferent`, `add`, `replace` or `doNothing`.
220
230
+
221
231
With `addIfDifferentNeighbor`, a new trailer will be added only if no
222
- trailer with the same (<token >, <value>) pair is above or below the line
232
+ trailer with the same (<key >, <value>) pair is above or below the line
223
233
where the new trailer will be added.
224
234
+
225
235
With `addIfDifferent`, a new trailer will be added only if no trailer
226
- with the same (<token >, <value>) pair is already in the input.
236
+ with the same (<key >, <value>) pair is already in the input.
227
237
+
228
238
With `add`, a new trailer will be added, even if some trailers with
229
- the same (<token >, <value>) pair are already in the input.
239
+ the same (<key >, <value>) pair are already in the input.
230
240
+
231
- With `replace`, an existing trailer with the same <token > will be
241
+ With `replace`, an existing trailer with the same <key > will be
232
242
deleted and the new trailer will be added. The deleted trailer will be
233
- the closest one (with the same <token >) to the place where the new one
243
+ the closest one (with the same <key >) to the place where the new one
234
244
will be added.
235
245
+
236
246
With `doNothing`, nothing will be done; that is no new trailer will be
237
- added if there is already one with the same <token > in the input.
247
+ added if there is already one with the same <key > in the input.
238
248
239
249
trailer.ifmissing::
240
250
This option makes it possible to choose what action will be
241
251
performed when there is not yet any trailer with the same
242
- <token > in the input.
252
+ <key > in the input.
243
253
+
244
254
The valid values for this option are: `add` (this is the default) and
245
255
`doNothing`.
@@ -248,64 +258,70 @@ With `add`, a new trailer will be added.
248
258
+
249
259
With `doNothing`, nothing will be done.
250
260
251
- trailer.<token>.key::
252
- This `key` will be used instead of <token> in the trailer. At
253
- the end of this key, a separator can appear and then some
254
- space characters. By default the only valid separator is ':',
255
- but this can be changed using the `trailer.separators` config
256
- variable.
261
+ trailer.<keyAlias>.key::
262
+ Defines a <keyAlias> for the <key>. The <keyAlias> must be a
263
+ prefix (case does not matter) of the <key>. For example, in `git
264
+ config trailer.ack.key "Acked-by"` the "Acked-by" is the <key> and
265
+ the "ack" is the <keyAlias>. This configuration allows the shorter
266
+ `--trailer "ack:..."` invocation on the command line using the "ack"
267
+ <keyAlias> instead of the longer `--trailer "Acked-by:..."`.
268
+ +
269
+ At the end of the <key>, a separator can appear and then some
270
+ space characters. By default the only valid separator is ':',
271
+ but this can be changed using the `trailer.separators` config
272
+ variable.
257
273
+
258
274
If there is a separator in the key, then it overrides the default
259
275
separator when adding the trailer.
260
276
261
- trailer.<token >.where::
277
+ trailer.<keyAlias >.where::
262
278
This option takes the same values as the 'trailer.where'
263
279
configuration variable and it overrides what is specified by
264
- that option for trailers with the specified <token >.
280
+ that option for trailers with the specified <keyAlias >.
265
281
266
- trailer.<token >.ifexists::
282
+ trailer.<keyAlias >.ifexists::
267
283
This option takes the same values as the 'trailer.ifexists'
268
284
configuration variable and it overrides what is specified by
269
- that option for trailers with the specified <token >.
285
+ that option for trailers with the specified <keyAlias >.
270
286
271
- trailer.<token >.ifmissing::
287
+ trailer.<keyAlias >.ifmissing::
272
288
This option takes the same values as the 'trailer.ifmissing'
273
289
configuration variable and it overrides what is specified by
274
- that option for trailers with the specified <token >.
290
+ that option for trailers with the specified <keyAlias >.
275
291
276
- trailer.<token >.command::
277
- Deprecated in favor of 'trailer.<token >.cmd'.
278
- This option behaves in the same way as 'trailer.<token >.cmd', except
292
+ trailer.<keyAlias >.command::
293
+ Deprecated in favor of 'trailer.<keyAlias >.cmd'.
294
+ This option behaves in the same way as 'trailer.<keyAlias >.cmd', except
279
295
that it doesn't pass anything as argument to the specified command.
280
296
Instead the first occurrence of substring $ARG is replaced by the
281
297
<value> that would be passed as argument.
282
298
+
283
299
Note that $ARG in the user's command is
284
300
only replaced once and that the original way of replacing $ARG is not safe.
285
301
+
286
- When both 'trailer.<token >.cmd' and 'trailer.<token >.command' are given
287
- for the same <token >, 'trailer.<token >.cmd' is used and
288
- 'trailer.<token >.command' is ignored.
302
+ When both 'trailer.<keyAlias >.cmd' and 'trailer.<keyAlias >.command' are given
303
+ for the same <keyAlias >, 'trailer.<keyAlias >.cmd' is used and
304
+ 'trailer.<keyAlias >.command' is ignored.
289
305
290
- trailer.<token >.cmd::
306
+ trailer.<keyAlias >.cmd::
291
307
This option can be used to specify a shell command that will be called
292
- once to automatically add a trailer with the specified <token >, and then
293
- called each time a '--trailer <token >=<value>' argument is specified to
308
+ once to automatically add a trailer with the specified <keyAlias >, and then
309
+ called each time a '--trailer <keyAlias >=<value>' argument is specified to
294
310
modify the <value> of the trailer that this option would produce.
295
311
+
296
312
When the specified command is first called to add a trailer
297
- with the specified <token >, the behavior is as if a special
298
- '--trailer <token >=<value>' argument was added at the beginning
313
+ with the specified <keyAlias >, the behavior is as if a special
314
+ '--trailer <keyAlias >=<value>' argument was added at the beginning
299
315
of the "git interpret-trailers" command, where <value>
300
316
is taken to be the standard output of the command with any
301
317
leading and trailing whitespace trimmed off.
302
318
+
303
- If some '--trailer <token >=<value>' arguments are also passed
319
+ If some '--trailer <keyAlias >=<value>' arguments are also passed
304
320
on the command line, the command is called again once for each
305
- of these arguments with the same <token >. And the <value> part
321
+ of these arguments with the same <keyAlias >. And the <value> part
306
322
of these arguments, if any, will be passed to the command as its
307
323
first argument. This way the command can produce a <value> computed
308
- from the <value> passed in the '--trailer <token >=<value>' argument.
324
+ from the <value> passed in the '--trailer <keyAlias >=<value>' argument.
309
325
310
326
EXAMPLES
311
327
--------
0 commit comments