mbox series

[v2,0/3] format-patch: teach `--header-cmd`

Message ID cover.1710873210.git.code@khaugsbakk.name (mailing list archive)
Headers show
Series format-patch: teach `--header-cmd` | expand

Message

Kristoffer Haugsbakk March 19, 2024, 6:35 p.m. UTC
(most of this is from the main commit/patch with some elaboration in
parts)

Teach git-format-patch(1) `--header-cmd` (with negation) and the
accompanying config variable `format.headerCmd` which allows the user to
add extra headers per-patch.

ยง Motivation

format-patch knows `--add-header`. However, that seems most useful for
series-wide headers; you cannot really control what the header is like
per patch or specifically for the cover letter. To that end, teach
format-patch a new option which runs a command that has access to the
hash of the current commit (if it is a code patch) and the patch count
which is used for the patch files that this command outputs. Also
include an environment variable which tells the version of this API so
that the command can detect and error out in case the API changes.

This is inspired by `--header-cmd` of git-send-email(1).[1]