public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
* [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
@ 2026-01-27 12:53 Breno Leitao
  2026-01-28 18:14 ` Luca Ceresoli
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Breno Leitao @ 2026-01-27 12:53 UTC (permalink / raw)
  To: Kernel.org Tools; +Cc: Konstantin Ryabitsev, kernel-team, 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/20260127-ipmi-v1-0-ba5cc90f516f@debian.org/

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 src/b4/command.py |  2 ++
 src/b4/ez.py      | 16 +++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/b4/command.py b/src/b4/command.py
index 1f8b8f1..0e685cd 100644
--- a/src/b4/command.py
+++ b/src/b4/command.py
@@ -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')
diff --git a/src/b4/ez.py b/src/b4/ez.py
index 298e382..42379a7 100644
--- a/src/b4/ez.py
+++ b/src/b4/ez.py
@@ -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,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-27 12:53 [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series Breno Leitao
@ 2026-01-28 18:14 ` Luca Ceresoli
  2026-01-28 18:47   ` Breno Leitao
  2026-01-29 11:18 ` Antonin Godard
  2026-02-24 18:57 ` Konstantin Ryabitsev
  2 siblings, 1 reply; 10+ messages in thread
From: Luca Ceresoli @ 2026-01-28 18:14 UTC (permalink / raw)
  To: Breno Leitao, Kernel.org Tools; +Cc: Konstantin Ryabitsev, kernel-team

Hello Breno,

On Tue Jan 27, 2026 at 1:53 PM CET, Breno Leitao wrote:
> 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/20260127-ipmi-v1-0-ba5cc90f516f@debian.org/
>
> Signed-off-by: Breno Leitao <leitao@debian.org>

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 <luca.ceresoli@bootlin.com>

[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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-28 18:14 ` Luca Ceresoli
@ 2026-01-28 18:47   ` Breno Leitao
  0 siblings, 0 replies; 10+ messages in thread
From: Breno Leitao @ 2026-01-28 18:47 UTC (permalink / raw)
  To: Luca Ceresoli; +Cc: Kernel.org Tools, Konstantin Ryabitsev, kernel-team

On Wed, Jan 28, 2026 at 07:14:37PM +0100, Luca Ceresoli wrote:
> Hello Breno,
> 
> On Tue Jan 27, 2026 at 1:53 PM CET, Breno Leitao wrote:
> > 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/20260127-ipmi-v1-0-ba5cc90f516f@debian.org/
> >
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> 
> 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 <luca.ceresoli@bootlin.com>

Awesome. I was missing it also, and I haven't seen your request.

Thanks for the tested!
--breno

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-27 12:53 [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series Breno Leitao
  2026-01-28 18:14 ` Luca Ceresoli
@ 2026-01-29 11:18 ` Antonin Godard
  2026-01-29 13:21   ` Breno Leitao
  2026-02-24 18:57 ` Konstantin Ryabitsev
  2 siblings, 1 reply; 10+ messages in thread
From: Antonin Godard @ 2026-01-29 11:18 UTC (permalink / raw)
  To: Breno Leitao, Kernel.org Tools; +Cc: Konstantin Ryabitsev, kernel-team

Hi,

On Tue Jan 27, 2026 at 1:53 PM CET, Breno Leitao wrote:
> 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/20260127-ipmi-v1-0-ba5cc90f516f@debian.org/
>
> Signed-off-by: Breno Leitao <leitao@debian.org>
> ---
>  src/b4/command.py |  2 ++
>  src/b4/ez.py      | 16 +++++++++-------
>  2 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/src/b4/command.py b/src/b4/command.py
> index 1f8b8f1..0e685cd 100644
> --- a/src/b4/command.py
> +++ b/src/b4/command.py
> @@ -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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-29 11:18 ` Antonin Godard
@ 2026-01-29 13:21   ` Breno Leitao
  2026-01-29 13:51     ` Antonin Godard
  0 siblings, 1 reply; 10+ messages in thread
From: Breno Leitao @ 2026-01-29 13:21 UTC (permalink / raw)
  To: Antonin Godard; +Cc: Kernel.org Tools, Konstantin Ryabitsev, kernel-team

On Thu, Jan 29, 2026 at 12:18:41PM +0100, Antonin Godard wrote:
> Hi,
> 
> On Tue Jan 27, 2026 at 1:53 PM CET, Breno Leitao wrote:
> > 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/20260127-ipmi-v1-0-ba5cc90f516f@debian.org/
> >
> > Signed-off-by: Breno Leitao <leitao@debian.org>
> > ---
> >  src/b4/command.py |  2 ++
> >  src/b4/ez.py      | 16 +++++++++-------
> >  2 files changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/src/b4/command.py b/src/b4/command.py
> > index 1f8b8f1..0e685cd 100644
> > --- a/src/b4/command.py
> > +++ b/src/b4/command.py
> > @@ -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.
> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-29 13:21   ` Breno Leitao
@ 2026-01-29 13:51     ` Antonin Godard
  2026-01-29 14:03       ` Breno Leitao
  0 siblings, 1 reply; 10+ messages in thread
From: Antonin Godard @ 2026-01-29 13:51 UTC (permalink / raw)
  To: Breno Leitao; +Cc: Kernel.org Tools, Konstantin Ryabitsev, kernel-team

On Thu Jan 29, 2026 at 2:21 PM CET, Breno Leitao wrote:
[...]
>> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-29 13:51     ` Antonin Godard
@ 2026-01-29 14:03       ` Breno Leitao
  2026-01-29 14:15         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Breno Leitao @ 2026-01-29 14:03 UTC (permalink / raw)
  To: Antonin Godard, konstantin
  Cc: Kernel.org Tools, Konstantin Ryabitsev, kernel-team

On Thu, Jan 29, 2026 at 02:51:05PM +0100, Antonin Godard wrote:
> On Thu Jan 29, 2026 at 2:21 PM CET, Breno Leitao wrote:
> [...]
> >> 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.

> 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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-29 14:03       ` Breno Leitao
@ 2026-01-29 14:15         ` Mark Brown
  2026-01-29 15:00           ` Breno Leitao
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2026-01-29 14:15 UTC (permalink / raw)
  To: Breno Leitao; +Cc: Antonin Godard, konstantin, Kernel.org Tools, kernel-team

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

On Thu, Jan 29, 2026 at 06:03:44AM -0800, Breno Leitao wrote:
> On Thu, Jan 29, 2026 at 02:51:05PM +0100, Antonin Godard wrote:

> > 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-29 14:15         ` Mark Brown
@ 2026-01-29 15:00           ` Breno Leitao
  0 siblings, 0 replies; 10+ messages in thread
From: Breno Leitao @ 2026-01-29 15:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Antonin Godard, konstantin, Kernel.org Tools, kernel-team

Hello Mark,

On Thu, Jan 29, 2026 at 02:15:45PM +0000, Mark Brown wrote:
> On Thu, Jan 29, 2026 at 06:03:44AM -0800, Breno Leitao wrote:
> > On Thu, Jan 29, 2026 at 02:51:05PM +0100, Antonin Godard wrote:
> 
> > > 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.

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series
  2026-01-27 12:53 [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series Breno Leitao
  2026-01-28 18:14 ` Luca Ceresoli
  2026-01-29 11:18 ` Antonin Godard
@ 2026-02-24 18:57 ` Konstantin Ryabitsev
  2 siblings, 0 replies; 10+ messages in thread
From: Konstantin Ryabitsev @ 2026-02-24 18:57 UTC (permalink / raw)
  To: Kernel.org Tools, Breno Leitao; +Cc: kernel-team


On Tue, 27 Jan 2026 04:53:08 -0800, Breno Leitao wrote:
> 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,
-- 
KR



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-02-24 18:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 12:53 [PATCH b4] send: Add --force-cover-letter to send separate cover for single patch patch series Breno Leitao
2026-01-28 18:14 ` Luca Ceresoli
2026-01-28 18:47   ` Breno Leitao
2026-01-29 11:18 ` Antonin Godard
2026-01-29 13:21   ` Breno Leitao
2026-01-29 13:51     ` Antonin Godard
2026-01-29 14:03       ` Breno Leitao
2026-01-29 14:15         ` Mark Brown
2026-01-29 15:00           ` Breno Leitao
2026-02-24 18:57 ` Konstantin Ryabitsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox