send: Add --force-cover-letter to send separate cover for single patch patch series
PATCH 1/1 send: Add --force-cover-letter to send separate cover for single patch patch series
By default, b4 mixes the cover letter content into the patch body (under the --- cut line) when sending a single-patch series. Add --force-cover-letter option to allow sending a separate cover letter message (as 0/1) even for single-patch series.
This is useful when developers want to send a long cover letter with extra information about an issue, and a commit. Having the cover-letter "mixed-in" makes it hard to follow.
Example:
* https://lore.kernel.org/all/[email protected]/
--- src/b4/command.py | 2 ++ src/b4/ez.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)
src/b4/command.py +2 -0
@@ -397,6 +397,8 @@ def setup_parser() -> argparse.ArgumentParser: help='Resend a previously sent version of the series') sp_send.add_argument('--no-sign', action='store_true', default=False, help='Do not add the cryptographic attestation signature header') + sp_send.add_argument('--force-cover-letter', action='store_true', default=False, + help='Send a cover letter even for single-patch series') sp_send.add_argument('--use-web-endpoint', dest='send_web', action='store_true', default=False, help="Force going through the web endpoint") ag_sendh = sp_send.add_argument_group('Web submission', 'Authenticate with the web submission endpoint')
src/b4/ez.py +9 -7
@@ -1567,7 +1567,7 @@ def rethread(patches: List[Tuple[str, EmailMessage]]) -> None: def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtracking: bool = True, prefixes: Optional[List[str]] = None, usebranch: Optional[str] = None, - expandprereqs: bool = True, + expandprereqs: bool = True, force_cover: bool = False, ) -> Tuple[List[Tuple[str, str]], List[Tuple[str, str]], str, List[Tuple[str, EmailMessage]]]: cover, tracking = load_cover(strip_comments=True, usebranch=usebranch)
@@ -1735,7 +1735,7 @@ def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtr thdata = ''.join(wrapped).replace('X-B4-Tracking: ', '') alltos, allccs, cbody = get_cover_dests(cover_letter) - if len(patches) == 1: + if len(patches) == 1 and not force_cover: mixin_cover(cbody, patches) else: add_cover(csubject, msgid_tpt, patches, cbody, seriests, thread=thread, presubject=presubject)
@@ -1767,7 +1767,7 @@ def get_prep_branch_as_patches(movefrom: bool = True, thread: bool = True, addtr return alltos, allccs, tag_msg, patches -def get_sent_tag_as_patches(tagname: str, revision: int, presubject: str = None) \ +def get_sent_tag_as_patches(tagname: str, revision: int, presubject: str = None, force_cover: bool = False) \ -> Tuple[List[Tuple[str, str]], List[Tuple[str, str]], List[Tuple[str, EmailMessage]]]: cover, base_commit, change_id = get_base_changeid_from_tag(tagname)
@@ -1787,7 +1787,7 @@ def get_sent_tag_as_patches(tagname: str, revision: int, presubject: str = None) presubject=presubject) alltos, allccs, cbody = get_cover_dests(cbody) - if len(patches) == 1: + if len(patches) == 1 and not force_cover: mixin_cover(cbody, patches) else: add_cover(csubject, msgid_tpt, patches, cbody, seriests)
@@ -1942,8 +1942,9 @@ def cmd_send(cmdargs: argparse.Namespace) -> None: presubject = tracking['series'].get('presubject', None) try: - todests, ccdests, patches = get_sent_tag_as_patches(tagname, revision=revision, - presubject=presubject) + todests, ccdests, patches = get_sent_tag_as_patches(tagname, revision=revision, + presubject=presubject, + force_cover=cmdargs.force_cover_letter) except RuntimeError as ex: logger.critical('CRITICAL: Failed to convert tag to patches: %s', ex) sys.exit(1)
@@ -1963,7 +1964,8 @@ def cmd_send(cmdargs: argparse.Namespace) -> None: prefixes = None try: - todests, ccdests, tag_msg, patches = get_prep_branch_as_patches(prefixes=prefixes) + todests, ccdests, tag_msg, patches = get_prep_branch_as_patches(prefixes=prefixes, + force_cover=cmdargs.force_cover_letter) except RuntimeError as ex: logger.critical('CRITICAL: Failed to convert range to patches: %s', ex) sys.exit(1)
---
base-commit: 477734000555ffc24bf873952e40367deee26f17
change-id: 20260127-force-cover-letter-e17dfceb28e4
Best regards,
Signature · 1 line
Breno Leitao <[email protected]>
Hello Breno,
Quoted 5 lines · Breno Leitao
By default, b4 mixes the cover letter content into the patch body (under the --- cut line) when sending a single-patch series. Add --force-cover-letter option to allow sending a separate cover letter message (as 0/1) even for single-patch series.
Quoted 8 lines
This is useful when developers want to send a long cover letter with extra information about an issue, and a commit. Having the cover-letter "mixed-in" makes it hard to follow.
Example:
* https://lore.kernel.org/all/[email protected]/Signed-off-by Breno Leitao <[email protected]>
Thanks! This is a feature I had requiested some time ago [0] so I'm very heppy to see it implemented.
I just tested it successfully to send a 1-patch series [1].
[0] https://lore.kernel.org/tools/20250619113855.6a271fa6@booty/
[1] https://lore.kernel.org/lkml/20260128-drm-bridge-fix-imx8qxp-pixel-combiner-null-deref-v1-0-2138d0933cf1@bootlin.com/
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Quoted 15 lines · Luca Ceresoli
Hello Breno,
Quoted 12 lines · Breno Leitao
By default, b4 mixes the cover letter content into the patch body (under the --- cut line) when sending a single-patch series. Add --force-cover-letter option to allow sending a separate cover letter message (as 0/1) even for single-patch series.
This is useful when developers want to send a long cover letter with extra information about an issue, and a commit. Having the cover-letter "mixed-in" makes it hard to follow.
Quoted 8 lines
Quoted 1 line
Signed-off-by Breno Leitao <[email protected]>Thanks! This is a feature I had requiested some time ago [0] so I'm very heppy to see it implemented.
I just tested it successfully to send a 1-patch series [1].
Tested-by Luca Ceresoli <[email protected]>
Awesome. I was missing it also, and I haven't seen your request.
Thanks for the tested!
--breno
Hi,
Quoted 23 lines · Breno Leitao
By default, b4 mixes the cover letter content into the patch body (under the --- cut line) when sending a single-patch series. Add --force-cover-letter option to allow sending a separate cover letter message (as 0/1) even for single-patch series.
This is useful when developers want to send a long cover letter with extra information about an issue, and a commit. Having the cover-letter "mixed-in" makes it hard to follow.
Example:
* https://lore.kernel.org/all/[email protected]/Signed-off-by Breno Leitao <[email protected]>--- src/b4/command.py | 2 ++ src/b4/ez.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)src/b4/command.py +0
-0
src/b4/command.py def setup_parser() -> argparse.ArgumentParser: · line 401
Quoted 5 lines
src/b4/command.py +2
-0@@ -397,6 +397,8 @@ def setup_parser() -> argparse.ArgumentParser: help='Resend a previously sent version of the series') sp_send.add_argument('--no-sign', action='store_true', default=False, help='Do not add the cryptographic attestation signature header') + sp_send.add_argument('--force-cover-letter', action='store_true', default=False, + help='Send a cover letter even for single-patch series')
I've had a different idea with this which would go a bit further.
Instead of --force-cover-letter, have a --cover-letter option which acts as follows:
* --cover-letter=yes: always generate a cover-letter, no matter if it's a single patch or not
* --cover-letter=auto (default): generate a cover-letter when there is more than one patch. This is the current behavior.
* --cover-letter=no: do not generate a cover-letter, even on multi-patch series
This would be backed up by a setting (b4.send-cover-letter?) which can be set globally or on a per-branch basis.
I don't know how easy it would be to support the last use-case though, as I don't know how b4 is going to behave with a multi-patch series with no cover-letter, but since you figured out the code paths I guess it would be relatively easy to try? Obviously, --edit-cover would have to be adapted as well to refuse editing the cover when --cover-letter=no.
I do find myself needing the last use-case sometimes, when the series does not require a cover-letter.
What do you think?
Antonin
Quoted 46 lines · Antonin Godard
Hi,
Quoted 23 lines · Breno Leitao
By default, b4 mixes the cover letter content into the patch body (under the --- cut line) when sending a single-patch series. Add --force-cover-letter option to allow sending a separate cover letter message (as 0/1) even for single-patch series.
This is useful when developers want to send a long cover letter with extra information about an issue, and a commit. Having the cover-letter "mixed-in" makes it hard to follow.
Example:
* https://lore.kernel.org/all/[email protected]/Signed-off-by Breno Leitao <[email protected]>--- src/b4/command.py | 2 ++ src/b4/ez.py | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)src/b4/command.py +0
-0src/b4/command.py def setup_parser() -> argparse.ArgumentParser: · line 401
Quoted 5 lines
src/b4/command.py +2
-0@@ -397,6 +397,8 @@ def setup_parser() -> argparse.ArgumentParser: help='Resend a previously sent version of the series') sp_send.add_argument('--no-sign', action='store_true', default=False, help='Do not add the cryptographic attestation signature header') + sp_send.add_argument('--force-cover-letter', action='store_true', default=False, + help='Send a cover letter even for single-patch series')I've had a different idea with this which would go a bit further.
Instead of --force-cover-letter, have a --cover-letter option which acts as follows:
* --cover-letter=yes: always generate a cover-letter, no matter if it's a single patch or not
* --cover-letter=auto (default): generate a cover-letter when there is more than one patch. This is the current behavior.
* --cover-letter=no: do not generate a cover-letter, even on multi-patch series globally or on a per-branch basis.
Quoted 8 lines
I don't know how easy it would be to support the last use-case though, as I don't know how b4 is going to behave with a multi-patch series with no cover-letter, but since you figured out the code paths I guess it would be relatively easy to try? Obviously, --edit-cover would have to be adapted as well to refuse editing the cover when --cover-letter=no.
I do find myself needing the last use-case sometimes, when the series does not require a cover-letter.
Why do you need this case? I undertand a cover letter is required for a multi patch series, so, it can have an easy merge commit when merging the series.
Thanks
--breno
On Thu Jan 29, 2026 at 2:21 PM CET, Breno Leitao wrote:
[...]
Quoted 6 lines
Quoted 2 lines
I do find myself needing the last use-case sometimes, when the series does not require a cover-letter.
Why do you need this case? I undertand a cover letter is required for a multi patch series, so, it can have an easy merge commit when merging the series.
Some project ignore merge commits altogether, so I regularly see series without cover letters. Are merge commits that frequent? I'm not judging on whether it's good practice or not, but introducing a --force-cover-letter option would maybe not leave room for having such a use-case in the future.
Antonin
Quoted 11 lines · Antonin Godard
On Thu Jan 29, 2026 at 2:21 PM CET, Breno Leitao wrote:
[...]Quoted 6 lines
Quoted 2 lines
I do find myself needing the last use-case sometimes, when the series does not require a cover-letter.
Why do you need this case? I undertand a cover letter is required for a multi patch series, so, it can have an easy merge commit when merging the series.
Some project ignore merge commits altogether, so I regularly see series without cover letters. Are merge commits that frequent?
The trees I am familiar with, they add the cover letter to the merge commit, which I personally think this is a good practice, but I am quite sure we don't do it everywhere.
Quoted 3 lines
I'm not judging on whether it's good practice or not, but introducing a --force-cover-letter option would maybe not leave room for having such a use-case in the future.
Agree. I am wondering if b4 maintainers want to have this possibility. Let's see what Konstantin has to say.
Quoted 8 lines · Breno Leitao
Quoted 2 lines · Antonin Godard
Some project ignore merge commits altogether, so I regularly see series without cover letters. Are merge commits that frequent?
The trees I am familiar with, they add the cover letter to the merge commit, which I personally think this is a good practice, but I am quite sure we don't do it everywhere.
I think it's more a question about if you get merge commits, within the kernel that's very subsystem workflow dependent - a lot of subsystems have a fairly linear history, they just apply patch serieses on top of each other on a single branch so merges are very infrequent.
Hello Mark,
Quoted 6 lines · Mark Brown
Quoted 4 lines · Breno Leitao
Quoted 2 lines · Antonin Godard
Some project ignore merge commits altogether, so I regularly see series without cover letters. Are merge commits that frequent?
Quoted 8 lines
Quoted 3 lines
The trees I am familiar with, they add the cover letter to the merge commit, which I personally think this is a good practice, but I am quite sure we don't do it everywhere.
I think it's more a question about if you get merge commits, within the kernel that's very subsystem workflow dependent - a lot of subsystems have a fairly linear history, they just apply patch serieses on top of each other on a single branch so merges are very infrequent.
Thank you for the clarification. If I understand correctly, it would be reasonable to add an option to b4 that skips generating a separate cover letter for multi-patch series.
In this approach, the first patch would serve as the cover letter, and all subsequent patches would reference it as their reply-to.
Konstantin Ryabitsev
AppliedQuoted 1 line · Breno Leitao
send: Add --force-cover-letter to send separate cover for single patch patch series
Applied, thanks!
[1/1] send: Add --force-cover-letter to send separate cover for single patch patch series
commit: 858baa2b2eeb93ea1b0e1b57adfb77e4a126043e
Best regards,
Signature · 1 line
KR