Message ID | 20221114-prep-format-patch-single-patch-to-cc-v2-0-70a9019eb90c@theobroma-systems.com (mailing list archive) |
---|---|
State | Rejected |
Headers | show |
Series | [v2] git_range_to_patches: actually add to/cc headers from cover letter to single-commit series | expand |
On Tue, Nov 15, 2022 at 06:31:04PM +0100, Quentin Schulz wrote: > 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. This was intentional -- `b4 prep -p` generates minimal headers (i.e. operates in git-format-patch compatible mode). If you want to generate the series as ready to sent out, you should use `b4 send -o`, which will populate To/Cc fields (among other headers). > 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. I did a (totally unscientific) polling and the results were that almost all maintainers preferred to receive the entire patch series and never just individual patches, which is why b4 operates this way. The To/Cc destinations are only tracked in the cover letter and when "b4 send" is invoked, we populate *all* messages with the same set of addresses to make sure that everyone gets the entire series. > 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? Are you sure this isn't already done by `b4 send -o`? -K
Hi Konstantin, On 11/15/22 20:43, Konstantin Ryabitsev wrote: > On Tue, Nov 15, 2022 at 06:31:04PM +0100, Quentin Schulz wrote: >> 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. > > This was intentional -- `b4 prep -p` generates minimal headers (i.e. operates > in git-format-patch compatible mode). If you want to generate the series as > ready to sent out, you should use `b4 send -o`, which will populate To/Cc > fields (among other headers). > Ahah! RTFM :) >> 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. > > I did a (totally unscientific) polling and the results were that almost all > maintainers preferred to receive the entire patch series and never just > individual patches, which is why b4 operates this way. The To/Cc destinations > are only tracked in the cover letter and when "b4 send" is invoked, we > populate *all* messages with the same set of addresses to make sure that > everyone gets the entire series. > >> 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? > > Are you sure this isn't already done by `b4 send -o`? > It is. I think I got confused by the name (I don't want to use b4 for sending mails right now) and didn't even look into it. This works fine for me, thanks for the pointers. Sorry for the noise, please carry on :) Cheers, Quentin
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))