Linux maintainer tooling and workflows
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Quentin Schulz <foss+kernel@0leil.net>,
	"Kernel.org Tools" <tools@linux.kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Subject: Re: [PATCH v2] git_range_to_patches: actually add to/cc headers from cover letter to single-commit series
Date: Tue, 15 Nov 2022 18:31:04 +0100	[thread overview]
Message-ID: <0eeb50bf-9a09-6127-ae50-e838a9261042@theobroma-systems.com> (raw)
In-Reply-To: <20221114-prep-format-patch-single-patch-to-cc-v2-0-70a9019eb90c@theobroma-systems.com>

Hi all,

I resent this as v2 with a minimal change because I had messed up my 
local sendemail config which meant it was sent to spam for most people 
(including myself :) ).

I take this opportunity to discuss what we should do in a bigger context.

The issue with this patchset is that it only fixes single-commit series 
(which is already a good start). However, patches generated with b4 prep 
-p patches for bigger series are broken because the Cc: and To: fields 
generated by b4 prep --auto-to-cc do not make it to individual patches, 
only to the cover letter.

I could suggest to *always* add the To: and Cc: fields from the cover 
letter into each individual patch headers but I know some 
contributors/maintainers like to have a patch series with not all 
patches sent to all people impacted by at least one patch. E.g. for a 
new driver only the patch for dt-bindings would be sent to the 
dt-bindings ML, while the other patches would be sent to their 
appropriate subsystems too. I personally don't do this but I'm aware 
this is a possible workflow.

I could see what I can do for the workflow where all Cc: and To: fields 
from the mailing lists are added as headers to each individual patch in 
a series if there's some interest for it?

What do you think?

Cheers,
Quentin

On 11/15/22 18:23, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> The intent of the original code was to copy the Cc and To headers from
> the cover letter, previously added with b4 prep --auto-to-cc. However,
> those are added in the commit log which means a newline is inserted
> between the subject header and the start of the commit log, "breaking"
> the mail parsing because the rest is assumed to be the body of the mail.
> 
> Since the To: and Cc: lines are assumed to be in-body, and therefore not
> parsed by the mail backend, they cannot be fetched with mail.get('To')
> since the header isn't actually set.
> 
> Instead, let's use the Cc and To fields returned by get_body_parts of
> the covermsg into ctrailers list of LoreTrailer and then add the ones
> that are supposed to be To or Cc headers to the single-commit patch
> headers.
> 
> Fixes: 6c215d83473d ("ez: don't send a cover letter for a 1-patch series")
> Fixes: c748abf6ad2a ("ez: don't send a cover letter for a 1-patch series") #v0.10.1
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
> git_range_to_patches: actually add to/cc headers from cover letter to single-commit series
> 
> This probably wasn't detected because git-send-email is capable of
> adding the Cc: fields in the "snipped" section of a patch (---) even if not in
> the headers but not the To: fields.
> 
> To: "Kernel.org Tools" <tools@linux.kernel.org>
> Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
> ---
> Changes in v2:
> - fix From: field,
> - remove list cast for ctrailers as unnecessary,
> - Link to v1: https://urldefense.com/v3/__https://msgid.link/20221114-prep-format-patch-single-patch-to-cc-v1-0-e8dddbd07096@theobroma-systems.com__;!!OOPJP91ZZw!jLjSjQiC6nnLDYzEtcDnFpy3MKaEznFDBJ2ZIwawgkZKTJ7V1PyHs5Mkk95FXr0b8qphsxDoo2YyDviCnFmsz5ziKFOyZdgCbseB$
> ---
>   b4/__init__.py | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/b4/__init__.py b/b4/__init__.py
> index f5bbc53..590c756 100644
> --- a/b4/__init__.py
> +++ b/b4/__init__.py
> @@ -2779,13 +2779,11 @@ def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
>   
>               pbody = LoreMessage.rebuild_message(pheaders, pmessage, ptrailers, newbasement, csignature)
>               pmsg.set_payload(pbody, charset='utf-8')
> +
>               # Add any To: and Cc: headers from the cover_message
> -            toh = covermsg.get('To')
> -            if toh:
> -                pmsg.add_header('To', toh)
> -            cch = covermsg.get('Cc')
> -            if cch:
> -                pmsg.add_header('Cc', cch)
> +            for ctrailer in ctrailers:
> +                if ctrailer.name in ('To', 'Cc'):
> +                    pmsg.add_header(ctrailer.name, ctrailer.value)
>               startfrom = 0
>           else:
>               patches.insert(0, (None, covermsg))
> 
> ---
> base-commit: 287477e9e0149b42e444471da9dca629ebacf2e1
> change-id: 20221114-prep-format-patch-single-patch-to-cc-2a878158d50b
> 
> Best regards,

  reply	other threads:[~2022-11-15 17:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-15 17:23 [PATCH v2] git_range_to_patches: actually add to/cc headers from cover letter to single-commit series Quentin Schulz
2022-11-15 17:31 ` Quentin Schulz [this message]
2022-11-15 19:43   ` Konstantin Ryabitsev
2022-11-16 10:45     ` Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0eeb50bf-9a09-6127-ae50-e838a9261042@theobroma-systems.com \
    --to=quentin.schulz@theobroma-systems.com \
    --cc=foss+kernel@0leil.net \
    --cc=konstantin@linuxfoundation.org \
    --cc=tools@linux.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).