From 4d1673ea2d845709f1fed3cd314c7a36e53a1c65 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 30 Mar 2020 18:30:04 -0400 Subject: Escape From lines in git-format-patch output We need a valid mboxo format for python, so make sure to escape all From lines not actually starting a new message, per mboxo requirements. Signed-off-by: Konstantin Ryabitsev --- b4/pr.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/b4/pr.py b/b4/pr.py index e97dbce..015375a 100644 --- a/b4/pr.py +++ b/b4/pr.py @@ -222,6 +222,10 @@ def explode(gitdir, lmsg, savefile): logger.critical(out) sys.exit(ecode) + # Fix From lines to make sure this is a valid mboxo + out = re.sub(r'^From (?![a-f0-9]+ \w+ \w+ \d+ \d+:\d+:\d+ \d+$)', '>From ', out, 0, re.M) + print(out) + # Save patches into a temporary file patchmbx = mkstemp()[1] with open(patchmbx, 'w') as fh: -- cgit v1.2.3