tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH b4] Limit 'From mboxrd@z' replacement to start of message
@ 2021-05-28  4:26 Kyle Meyer
  2021-05-28 12:57 ` Konstantin Ryabitsev
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2021-05-28  4:26 UTC (permalink / raw)
  To: tools

save_git_am_mbox() replaces 'From mboxrd@z ' with 'From git@z ' to
make it clear that the output format is not mboxrd.  However, all
occurrences in the message are replaced, corrupting patches that
contain 'From mboxrd@z '.  Restrict the replacement to the first line
of the message.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
---
 b4/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index 2b35a42..17c569d 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2275,7 +2275,7 @@ def save_git_am_mbox(msgs: list, dest):
         bmsg = msg.as_bytes(unixfrom=True, policy=emlpolicy)
         # public-inbox unixfrom says "mboxrd", so replace it with something else
         # so there is no confusion as it's NOT mboxrd
-        bmsg = bmsg.replace(b'From mboxrd@z ', b'From git@z ')
+        bmsg = re.sub(b'^From mboxrd@z ', b'From git@z ', bmsg)
         bmsg = bmsg.rstrip(b'\r\n') + b'\n\n'
         dest.write(bmsg)
 

base-commit: ee5e56d06c786d7906c214fc1f8cbbeeb3e658a6
-- 
2.31.1


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

* Re: [PATCH b4] Limit 'From mboxrd@z' replacement to start of message
  2021-05-28  4:26 [PATCH b4] Limit 'From mboxrd@z' replacement to start of message Kyle Meyer
@ 2021-05-28 12:57 ` Konstantin Ryabitsev
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Ryabitsev @ 2021-05-28 12:57 UTC (permalink / raw)
  To: tools, Kyle Meyer

On Fri, 28 May 2021 00:26:35 -0400, Kyle Meyer wrote:
> save_git_am_mbox() replaces 'From mboxrd@z ' with 'From git@z ' to
> make it clear that the output format is not mboxrd.  However, all
> occurrences in the message are replaced, corrupting patches that
> contain 'From mboxrd@z '.  Restrict the replacement to the first line
> of the message.

Applied, thanks!

[1/1] Limit 'From mboxrd@z' replacement to start of message
      commit: 74c8e095354e5401a4fc02259f7871c40392b690

Best regards,
-- 
Konstantin Ryabitsev <konstantin@linuxfoundation.org>

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

end of thread, other threads:[~2021-05-28 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-28  4:26 [PATCH b4] Limit 'From mboxrd@z' replacement to start of message Kyle Meyer
2021-05-28 12: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;
as well as URLs for NNTP newsgroup(s).