aboutsummaryrefslogtreecommitdiffstats
path: root/docs/config.rst
blob: caa6e38ad97165cabaf80d6074e93adf7cf39e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
Configuration options
=====================
B4 doesn't have a separate configuration file but will use
``git-config`` to retrieve a set of b4-specific settings. This means
that you can have three levels of b4 configuration:

- system-wide, in ``/etc/gitconfig``
- per-user, in ``$HOME/.gitconfig``
- per-repo, in ``somerepo/.git/config``

Since the purpose of b4 is to work with git repositories, this allows
the usual fall-through configuration that can be overridden by more
local settings on the repository level.

Per-project defaults
~~~~~~~~~~~~~~~~~~~~
.. note::

   This feature is new in v0.10.

A project may ship their own b4 config with some defaults, placed in the
toplevel of the git tree. If you're not sure where a configuration
option is coming from, check if there is a ``.b4-config`` file in the
repository you're currently using.

Configuration options
---------------------
All settings are under the ``b4`` section. E.g to set a ``b4.midmask``
option, you can just edit your ``~/.gitconfig`` or ``.git/config`` file
and add the following section::

    [b4]
      midmask = https://some.host/%s

Core options
~~~~~~~~~~~~
These options control many of the core features of b4.

``b4.midmask``
  When retrieving threads by message-id, b4 will use ``midmask`` to
  figure out from which server they should be retrieved.

  Default: ``https://lore.kernel.org/%s``

``b4.linkmask``
  When automatically generating ``Link:`` trailers, b4 will use this
  setting to derive the destination URL. If you want a shorter option,
  you can also use ``https://msgid.link/%s``, which is an alias for
  lore.kernel.org.

  Default: ``https://lore.kernel.org/%s``

``b4.searchmask`` (v0.9+)
  If the public-inbox server provides a global searchable index (usually
  in ``/all/``, this setting can be used to query and retrieve matching
  discussion threads based on specific search terms -- for example, to
  retrieve trailer updates using a series ``change-id`` identifier.

  Default: ``https://lore.kernel.org/all/?x=m&t=1&q=%s``

``b4.linktrailermask`` (v0.13+)
  This allows overriding the format of the Link: trailer, in case you
  want to call it something other thank "Link". For example, some
  projects require "Message-Id" trailers, so you can make b4 behave the
  way you like by setting::

      linktrailermask = Message-Id: <%s>

  The ``%s`` will be replaced by the message-id.

  Default: ``Link: https://lore.kernel.org/%s``

``b4.listid-preference`` (v0.8+)
  Messages are frequently sent to multiple distribution lists, and some
  servers may apply content munging to modify the headers or the message
  content. B4 will deduplicate the results and this configuration option
  defines the priority given to the ``List-Id`` header. It is a simple
  comma-separated string with shell-style globbing.

  Default: ``*.feeds.kernel.org, *.linux.dev,*.kernel.org,*``

``b4.save-maildirs``
  The "mbox" file format is actually several incompatible formats
  ("mboxo" vs "mboxrd", for example). If you want to avoid dealing with
  this problem, you can choose to always save retrieved messages as a
  Maildir instead.

  Default: ``no``

``b4.trailer-order``
  This lets you control the order of trailers that get added to your own
  custody section of the commit message. By default, b4 will apply these
  trailers in the order they were received (because this is mostly
  consumed by tooling and the order does not matter). However, if you
  wanted to list things in a specific order, you could try something
  like::

      trailer-order = link*,fixes*,acked*,reviewed*,tested*,*

  The "chain of custody" is an important concept in patch-based code
  review process, with each "Signed-off-by" trailer indicating where the
  custody section of previous reviewer ends and the new one starts. Your
  own custody section is anything between the previous-to-last
  "Signed-off-by" trailer (if any) and the bottom of the trailer
  section. E.g.::

      Fixes: abcde (Commit info)
      Suggested-by: Alex Reporter <alex.reporter@example.com>
      Signed-off-by: Betty Developer <betty.developer@example.com>
      Acked-by: Chandra Acker <chandra.acker@example.com>
      Reviewed-by: Debby Reviewer <debby.reviewer@example.com>
      Signed-off-by: Ezri Submaintainer <ezri.submaintainer@example.com>
      Link: https://msgid.link/some@thing.foo
      Tested-by: Finn Tester <finn.tester@example.com>
      Signed-off-by: Your Name <your.name@example.com>

  Your custody section is beneath "Ezri Submaintainer", so the only
  trailers considered for reordering are "Link" and "Tested-by" (your
  own Signed-off-by trailer is always at the bottom of your own custody
  section).

  Note: versions prior to v0.10 did not properly respect the chain of
  custody.

  Default: ``*``

``b4.trailers-ignore-from`` (v0.10+)
  A comma-separated list of addresses that should never be considered
  for follow-up trailers. This is useful when dealing with reports
  generated by automated bots that may insert trailer suggestions, such
  as the "kernel test robot." E.g.::

      [b4]
        trailers-ignore-from = lkp@intel.com, someotherbot@example.org

  Default: ``None``

``b4.cache-expire``
  B4 will cache retrieved threads by default, and this allows tweaking
  the time (in minutes) before cache is invalidated. Many commands also
  allow the ``--no-cache`` flag to force remote lookups.

  Default: ``10``

.. _shazam_settings:

shazam settings
~~~~~~~~~~~~~~~
These settings control how ``b4 shazam`` applies patches to your tree.

``b4.shazam-am-flags`` (v0.9+)
  Additional flags to pass to ``git am`` when applying patches.

  Default: ``None``

``b4.shazam-merge-flags`` (v0.9+)
  Additional flags to pass to ``git merge`` when performing a merge with
  ``b4 shazam -M``

  Default: ``--signoff``

``b4.shazam-merge-template`` (v0.9+)
  Path to a template to use when creating a merge commit. See
  ``shazam-merge-template.example`` for some info on how to tweak one.

  Default: ``None``


Attestation settings
~~~~~~~~~~~~~~~~~~~~

``b4.attestation-policy``
  B4 supports domain-level and end-to-end attestation of patches using
  the `patatt`_ library. There are four different operation modes:

  * ``off``: do not bother checking attestation at all
  * ``check``: print green checkmarks when attestation is passing, but
    nothing if attestation is failing (**DEPRECATED**, use ``softfail``)
  * ``softfail``: print green checkmarks when attestation is passing and
    red x-marks when it is failing
  * ``hardfail``: exit with an error when any attestation checks fail

  Default: ``softfail``

``b4.attestation-checkmarks``
  When reporting attestation results, b4 can output fancy unicode
  checkmarks, or plain old ascii ones:

  * ``fancy``: uses ✓/✗ checkmarks and colours
  * ``plain``: uses x/v checkmarks and no colours

  Default: ``fancy``

``b4.attestation-check-dkim``
  Controls whether to perform DKIM attestation checks.

  Default: ``yes``

``b4.attestation-staleness-days``
  This setting controls how long in the past attestation signatures can
  be made before we stop considering them valid. This helps avoid an
  attack where someone resends valid old patches that contain a known
  vulnerability.

  Default: ``30``

``b4.attestation-gnupghome``
  This allows setting ``GNUPGHOME`` before running PGP attestation
  checks using GnuPG.

  Default: ``None``

``b4.gpgbin``
  If you don't want to use the default ``gpg`` command, you can specify
  a path to a different binary. B4 will also use git's ``gpg.program``
  setting, if found.

  Default: ``None``

``b4.keyringsrc``
  See ``patatt`` for details on how to configure keyring lookups. For
  example, you can clone the kernel.org pgpkeys.git repository and use
  it for attestation without needing to import any keys into your GnuPG
  keyring::

      git clone https://git.kernel.org/pub/scm/docs/kernel/pgpkeys.git

  Then set the following in your ``~/.gitconfig``::

      [b4]
        keyringsrc = ~/path/to/pgpkeys/.keyring

  Default: ``None``

.. _ty_settings:

Thank-you (ty) settings
~~~~~~~~~~~~~~~~~~~~~~~
These settings control the behaviour of ``b4 ty`` command.

``b4.thanks-pr-template``, ``b4.thanks-am-template``
  These settings take a full path to the template to use when generating
  thank-you messages for contributors. See example templates provided
  with the project.

  Default: ``None``

``b4.thanks-commit-url-mask``
  Used when creating summaries for ``b4 ty``, and can be set to a value like::

      thanks-commit-url-mask = https://git.kernel.org/username/c/%.12s

  If not set, b4 will just specify the commit hashes.

  See this page for more info on convenient git.kernel.org shorterners:
  https://korg.docs.kernel.org/git-url-shorteners.html

  Default: ``None``

``b4.email-exclude`` (v0.9+)
  A comma-separated list of shell-style globbing patterns with addresses
  that should always be excluded from the recipient list.

  Default: ``None``

``b4.sendemail-identity`` (v0.8+)
  Sendemail identity to use when sending mail directly from b4 (applies
  to ``b4 send`` and ``b4 ty``). See ``man git-send-email`` for info
  about sendemail identities.

  Default: ``None``

``b4.ty-send-email`` (v0.11+)
  When set to ``yes``, will instruct ``b4 ty`` to send email directly
  instead of generating .thanks files.

  Default: ``no``


.. _patchwork_settings:

Patchwork integration settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your project uses a patchwork server, these settings allow you to
integrate your b4 workflow with patchwork.

``b4.pw-url`` (v0.10+)
  The URL of your patchwork server. Note, that this should point at the
  toplevel of your patchwork installation and NOT at the project patch
  listing. E.g.: ``https://patchwork.kernel.org/``.

  Default: ``None``

``b4.pw-key`` (v0.10+)
  You should be able to obtain an API key from your patchwork user
  profile. This API key will be used to perform actions on your behalf.

  Default: ``None``

``b4.pw-project`` (v0.10+)
  This should contain the name of your patchwork project, as seen in the
  URL subpath to it (e.g. ``linux-usb``).

  Default: ``None``

``b4.pw-review-state`` (v0.10+)
  When patchwork integration is enabled, every time you run ``b4 am`` or
  ``b4 shazam``, b4 will mark those patches as with this state. E.g.:
  ``under-review``).

  Default: ``None``

``b4.pw-accept-state`` (v0.10+)
  After you run ``b4 ty`` to thank the contributor, b4 will move the
  matching patches into this state. E.g.: ``accepted``.

  Default: ``None``

``b4.pw-discard-state`` (v0.10+)
  If you run ``b4 ty -d`` to delete the tracking information for a patch
  series, it will also be set on the patchwork server with this state.
  E.g.: ``deferred`` (or ``rejected``).

  Default: ``None``

.. _contributor_settings:

Contributor-oriented settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``b4.send-endpoint-web`` (v0.10+)
  The web submission endpoint to use (see :ref:`web_endpoint`).

  Default: ``None``

``b4.send-series-to`` (v0.10+)
  Address or comma-separated addresses to always add to the To: header
  (see :ref:`prep_recipients`).

  Default: ``None``

``b4.send-series-cc`` (v0.10+)
  Address or comma-separated addresses to always add to the Cc: header
  (see :ref:`prep_recipients`).

  Default: ``None``

``b4.send-no-patatt-sign`` (v0.10+)
  Do not sign patches with patatt before sending them (unless using the
  web submission endpoint where signing is required).

  Default: ``no``

``b4.send-auto-to-cmd`` (v0.10+)
  Command to use to generate the list of To: recipients. Has no effect
  if the specified script is not found in the repository.

  Default: ``scripts/get_maintainer.pl --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nol``

``b4.send-auto-cc-cmd`` (v0.10+)
  Command to use to generate the list of Cc: recipients. Has no effect
  if the specified script is not found in the repository.

  Default:: ``scripts/get_maintainer.pl --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom``


``b4.prep-cover-strategy`` (v0.10+)
  Alternative cover letter storage strategy to use (see :ref:`prep_cover_strategies`).

  Default: ``commit``

``b4.prep-cover-template`` (v0.10+)
  Path to the template to use for the cover letter.

  Default: ``None``


To document
-----------
``b4.gh-api-key``
  Deliberately undocumented because the feature is incomplete and poorly
  tested.

.. _`patatt`: https://pypi.org/project/patatt/