aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--b4/__init__.py7
-rw-r--r--b4/submit.py7
2 files changed, 10 insertions, 4 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index b5f2aa6..6af2acd 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -2431,10 +2431,12 @@ def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
if not commits:
raise RuntimeError(f'Could not run rev-list {start}..{end}')
for commit in commits:
- ecode, out = git_run_command(gitdir, ['show', '--format=email', commit], decode=False)
+ ecode, out = git_run_command(gitdir, ['show', '--format=email', '--encoding=utf-8', commit], decode=False)
if ecode > 0:
raise RuntimeError(f'Could not get a patch out of {commit}')
msg = email.message_from_bytes(out)
+ msg.set_charset('utf-8')
+ msg.replace_header('Content-Transfer-Encoding', '8bit')
logger.debug(' %s', msg.get('Subject'))
patches.append((commit, msg))
@@ -2462,6 +2464,7 @@ def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
# Move the original From and Date into the body
origfrom = msg.get('From')
if origfrom:
+ origfrom = LoreMessage.clean_header(origfrom)
origpair = email.utils.parseaddr(origfrom)
if origpair[1] != mailfrom[1]:
msg.replace_header('From', format_addrs([mailfrom]))
@@ -2484,7 +2487,7 @@ def git_range_to_patches(gitdir: Optional[str], start: str, end: str,
payload = '\n'.join(inbodyhdrs) + '\n\n' + payload
if not payload.find('\n-- \n') > 0:
payload += f'\n-- \nb4 {__VERSION__}\n'
- msg.set_payload(payload)
+ msg.set_payload(payload, charset='utf-8')
if extrahdrs is None:
extrahdrs = list()
diff --git a/b4/submit.py b/b4/submit.py
index b82b022..0834ff8 100644
--- a/b4/submit.py
+++ b/b4/submit.py
@@ -325,12 +325,15 @@ def update_trailers(cover_commit: str, cmdargs: argparse.Namespace) -> None:
logger.info('Calculating patch-ids from %s commits', len(patches)-1)
msg_map = dict()
commit_map = dict()
+ updates = dict()
# Ignore the cover letter
for commit, msg in patches[1:]:
body = msg.get_payload()
patchid = b4.LoreMessage.get_patch_id(body)
msg_map[patchid] = msg
commit_map[patchid] = commit
+ if signoff and f'{signoff[0]}: <{signoff[1]}>' not in body:
+ updates[patchid] = list()
if cmdargs.thread_msgid:
cmdargs.msgid = cmdargs.thread_msgid
@@ -348,7 +351,6 @@ def update_trailers(cover_commit: str, cmdargs: argparse.Namespace) -> None:
for list_msg in list_msgs:
bbox.add_message(list_msg)
- updates = dict()
lser = bbox.get_series(sloppytrailers=cmdargs.sloppytrailers)
mismatches = list(lser.trailer_mismatches)
for lmsg in lser.patches[1:]:
@@ -476,7 +478,7 @@ def send(cover_commit: str, cmdargs: argparse.Namespace) -> None:
}
body = Template(cover_template.lstrip()).safe_substitute(tptvals)
cmsg = email.message.EmailMessage()
- cmsg.set_payload(body)
+ cmsg.set_payload(body, charset='utf-8')
cmsg.add_header('Subject', csubject)
if cmdargs.prefixes:
prefixes = list(cmdargs.prefixes)
@@ -721,6 +723,7 @@ def main(cmdargs: argparse.Namespace) -> None:
if cmdargs.new_series_name:
start_new_series(cmdargs)
+ return
if not check_our_branch():
return