diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-03-30 11:20:09 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-03-30 11:20:09 -0400 |
commit | e110a35e7ea0a1c2bb3c350487a9fe34984592bf (patch) | |
tree | 9cfdc9f2aa01402b337711269e0713b6c50d948a | |
parent | 36296aa9306d1712777631dab01f8cd6ac348e65 (diff) | |
download | b4-e110a35e7ea0a1c2bb3c350487a9fe34984592bf.tar.gz |
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 <konstantin@linuxfoundation.org>
-rw-r--r-- | b4/pr.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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) |