mbox series

[0/2] Expose header information to git-send-email's sendemail-validate hook

Message ID 20221111021502.449662-1-michael.strawbridge@amd.com (mailing list archive)
Headers show
Series Expose header information to git-send-email's sendemail-validate hook | expand

Message

Michael Strawbridge Nov. 11, 2022, 2:15 a.m. UTC
Sure.  Thank you for the quick feedback.  Let me see if I can explain the idea.

Sometimes it can be helpful to react to special keywords in a git send-email subject line or specific email address.  Like perhaps one wants to do some kind of sorting of patches by mailing list or "to" email address.  You could use the sendemail-validate hook as a way to copy the patch to a specific location locally based on who you are emailing.  I'm sure there could be other uses for the smtp header information as well.  Presumably the header information is printed to stdout before sending an email, for other reasons too (this happens already).  My patch makes it possible to now automate any checks one might be doing manually with these headers.

With some testing I can confirm that encoded headers (like a utf8 string) get passed in encoded form.  The random example I tried was with the subject "Rhyddhewch y racŵn" and it is showns as "Subject: [PATCH] =?UTF-8?q?Rhyddhewch=20y=20rac=C5=B5n?=".  However, the original print of the smtp headers doesn't handle encoded text either, so it is no worse than current.

Lastly, with the validate code moving later there are some changes in output.  After my change, the user will get asked about: composed email (compose argument code), 8 bit encoding, who to send to, and which message-ID to reply to before validation.  Since these change the header information, validation needs to happen after.

Michael
PS- I fixed the Signed-off-by as well.


Michael Strawbridge (2):
  Expose header information to git-send-email's sendemail-validate hook
  Update sendemail-validate hook docs to add header file parameter

 Documentation/githooks.txt |  8 +++---
 git-send-email.perl        | 57 +++++++++++++++++++++++++-------------
 2 files changed, 41 insertions(+), 24 deletions(-)

Cc: Luben Tuikov <luben.tuikov@amd.com>
Cc: brian m. carlson <sandals@crustytoothpaste.net>