Thread (69 messages) flat view 69 messages, 4 authors, 2019-10-14

Re: [PATCH v2 4/4] format-patch: learn --infer-cover-letter option

From: Eric Sunshine <hidden>
Date: 2019-08-20 03:47:01

On Mon, Aug 19, 2019 at 7:53 PM Denton Liu [off-list ref] wrote:
We used to populate the subject of the cover letter generated by
git-format-patch with "*** SUBJECT HERE ***". However, if a user submits
multiple patchsets, they may want to keep a consistent subject between
rerolls.

If git-format-patch is run with `--infer-cover-letter` or
s/letter/subject/
`format.inferCoverSubject`, infer the subject for the cover letter from
the top line(s) of a branch description, similar to how a subject is
read from a commit message.
A possible rewrite of the entire commit message in imperative mood:

    Teach 'format-patch' to use the first line of the branch description
    as the Subject: of the generated cover letter, rather than
    "*** SUBJECT HERE ***", if --infer-cover-subject is specified (or the
    corresponding `format.inferCoverSubject` option is enabled). This
    complements existing inclusion of the branch description in the
    cover letter body.

A casual reader of this patch might wonder why this new useful
behavior isn't default, so it might make sense for the commit message
to further explain that making it default would potentially break
existing tooling.
quoted hunk ↗ jump to hunk
Signed-off-by: Denton Liu <redacted>
---
diff --git a/Documentation/config/format.txt b/Documentation/config/format.txt
@@ -36,6 +36,10 @@ format.subjectPrefix::
+format.inferCoverSubject::
+       A boolean value which lets you enable the
+       `--infer-cover-subject` option of format-patch by default.
As mentioned in my review of 3/4, it is common to mention the default
value at the end of the paragraph. So, perhaps:

    A boolean that controls whether or not to take the first line of
    the branch description as the subject for the cover letter. See the
    `--infer-cover-subject` option in linkgit:git-format-patch[1].
    Default is false.
quoted hunk ↗ jump to hunk
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
@@ -171,6 +172,14 @@ will want to ensure that threading is disabled for `git send-email`.
+--[no-]infer-cover-subject::
+       Instead of using the default "*** SUBJECT HERE ***" subject for
+       the cover letter, infer the subject from the branch's
+       description.
++
+Similar to a commit message, the subject is inferred as the beginning of
+the description up to and excluding the first blank line.
I think this can all be collapsed to the simpler:

    Use the beginning of the branch description (up to the first
    blank line) as the cover letter subject instead of the default
    "*** SUBJECT HERE ***".

or something.
quoted hunk ↗ jump to hunk
diff --git a/builtin/log.c b/builtin/log.c
@@ -1577,6 +1589,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
+               OPT_BOOL(0, "infer-cover-subject", &infer_cover_subject,
+                           N_("infer a cover letter subject from the branch description")),
Shorter: "infer cover letter subject from branch description"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help