From e110a35e7ea0a1c2bb3c350487a9fe34984592bf Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 30 Mar 2020 11:20:09 -0400 Subject: Only add From: in the body if different No need to add an extra From: into the body of the message if it's identical to the From in the original pull request. Signed-off-by: Konstantin Ryabitsev --- b4/pr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/b4/pr.py b/b4/pr.py index 50b0f1d..24fbf64 100644 --- a/b4/pr.py +++ b/b4/pr.py @@ -184,8 +184,11 @@ def explode(gitdir, lmsg, savefile): # Set the pull request message as cover letter for msg in pmbx: # Move the original From and Date into the body - body = msg.get_payload(decode=True) - body = 'From: %s\nDate: %s\n\n%s' % (msg['from'], msg['date'], body.decode('utf-8')) + prepend = list() + if msg['from'] != lmsg.msg['from']: + prepend.append('From: %s' % msg['from']) + prepend.append('Date: %s' % msg['date']) + body = '%s\n\n%s' % ('\n'.join(prepend), msg.get_payload(decode=True).decode('utf-8')) msg.set_payload(body) msubj = b4.LoreSubject(msg['subject']) msg.replace_header('Subject', msubj.full_subject) -- cgit v1.2.3