From d952f4b20bc1e805223e2aaf62ae69cb1d41fbea Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 20 Jul 2022 17:38:02 -0400 Subject: ez-send: don't wrap headers in format-patch mode When writing out message in format-patch compatibility mode, do not wrap headers, otherwise checkpatch or git-send-email may complain. Reported-by: Sudeep Holla Signed-off-by: Konstantin Ryabitsev --- b4/ez.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/b4/ez.py b/b4/ez.py index cec3a10..35bb622 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -710,11 +710,6 @@ def cmd_ez_send(cmdargs: argparse.Namespace) -> None: body = Template(cover_template.lstrip()).safe_substitute(tptvals) cmsg = email.message.EmailMessage() cmsg.add_header('Subject', csubject) - # Store tracking info in the header in a safe format, which should allow us to - # fully restore our work from the already sent series. - ztracking = gzip.compress(bytes(json.dumps(tracking), 'utf-8')) - b64tracking = base64.b64encode(ztracking) - cmsg.add_header('X-b4-tracking', ' '.join(textwrap.wrap(b64tracking.decode(), width=78))) cmsg.set_payload(body, charset='utf-8') if cmdargs.prefixes: prefixes = list(cmdargs.prefixes) @@ -856,7 +851,7 @@ def cmd_ez_send(cmdargs: argparse.Namespace) -> None: ls = b4.LoreSubject(subject) filen = '%s.patch' % ls.get_slug(sep='-') with open(os.path.join(cmdargs.output_dir, filen), 'w') as fh: - fh.write(msg.as_string(unixfrom=True, maxheaderlen=80)) + fh.write(msg.as_string(unixfrom=True, maxheaderlen=0)) logger.info(' %s', filen) return @@ -898,7 +893,12 @@ def cmd_ez_send(cmdargs: argparse.Namespace) -> None: continue if cover_msgid is None: cover_msgid = b4.LoreMessage.get_clean_msgid(msg) - msg.add_header('To', b4.format_addrs(allto)) + # Store tracking info in the header in a safe format, which should allow us to + # fully restore our work from the already sent series. + ztracking = gzip.compress(bytes(json.dumps(tracking), 'utf-8')) + b64tracking = base64.b64encode(ztracking) + cmsg.add_header('X-b4-tracking', ' '.join(textwrap.wrap(b64tracking.decode(), width=78))) + msg.add_header('To', b4.format_addrs(allto)) if allcc: msg.add_header('Cc', b4.format_addrs(allcc)) logger.info(' %s', msg.get('Subject')) -- cgit v1.2.3