aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-05-28 00:26:35 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2021-05-28 08:54:07 -0400
commit9182f651df9d6d61f138dab7a5d29871b47be6ba (patch)
treed1b5bcd026b670629f14ce5e1388a95f13fe62c6
parentee5e56d06c786d7906c214fc1f8cbbeeb3e658a6 (diff)
downloadb4-9182f651df9d6d61f138dab7a5d29871b47be6ba.tar.gz
Limit 'From mboxrd@z' replacement to start of message
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> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Link: https://lore.kernel.org/r/20210528042635.24959-1-kyle@kyleam.com
-rw-r--r--b4/__init__.py2
1 files changed, 1 insertions, 1 deletions
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)