mirror of
https://github.com/AdaCore/git-hooks.git
synced 2026-02-12 12:43:11 -08:00
This commit changes the hooks to always use the quoted-printable
encoding when sending emails. This replaces the use of 7bit, 8bit
and base64 encodings. A comment is added explaining the reasons
for choosing this encoding.
For the record, the expected output in our testsuite has been
adjusted automatically using the following Python script...
| #! /usr/bin/env python3
|
| import argparse
|
| def fixup(filename):
| with open(filename) as f:
| contents = f.read()
|
| new_contents = contents.replace(
| """\
| remote: DEBUG: MIME-Version: 1.0
| remote: Content-Transfer-Encoding: 7bit
| remote: Content-Type: text/plain; charset="utf-8"
| """,
| """\
| remote: DEBUG: Content-Type: text/plain; charset="utf-8"
| remote: MIME-Version: 1.0
| remote: Content-Transfer-Encoding: quoted-printable
| """,
| )
|
| new_contents = new_contents.replace(
| "remote: Content-Transfer-Encoding: base64",
| "remote: Content-Transfer-Encoding: quoted-printable",
| )
|
| if new_contents == contents:
| return
|
| with open(filename, "w") as f:
| f.write(new_contents)
|
|
| parser = argparse.ArgumentParser()
| parser.add_argument("files_list", nargs="+")
| args = parser.parse_args()
|
| for filename in args.files_list:
| fixup(filename)
... calling it as follow:
$ cd testsuite/tests
$ /path/to/myscript.py */run_test.py
I think a perl oneliner was also possible, but I couldn't get it
to work (multiline issue, I think).
This still left one testcase that needed adjustement
(post-receive_from_email); I just manually adjusted it.
Change-Id: I8455d24f8fe0b9a732c68090a21091db060e03f2
TN: TB22-001