git.hook-post-receive-email: + from git 1.8.3-1
git.hook.post-receive-email.sh: apply a Debian patch

From 1ff228ad3d4df35beba00cbffcf299a463f8f9bf Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@smarden.org>
Date: Thu, 11 Dec 2008 20:27:21 +0000
Subject: [PATCH 01/12] hooks/post-receive-email: set encoding to utf-8

Some email clients (e.g., claws-mail) display the message body
incorrectly when the charset is not defined explicitly in a
Content-Type header.  "git log" generates logs in UTF-8 encoding by
default, so add a Content-Type header declaring that encoding to
the emails the post-receive-email example hook sends.

[jn: also setting the Content-Transfer-Encoding so MTAs know what
 kind of mangling might be needed when sending to a non 8-bit clean
 SMTP host]

Requested-by: Alexander Gerasiov <gq@cs.msu.su>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

See also
https://github.com/siduction/git-latest-tag/
  commit/594fba4f9cce25f6f215d750a1d70d2af48aafcc
git.hook.post-receive-email.sh: apply a Debian patch

From d41b94fca5748b0e51f7d505641c396328714813 Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
Date: Fri, 7 Oct 2011 04:06:02 -0500
Subject: [PATCH 02/12] post-receive-email: defend against non-utf8
 i18n.logoutputencoding setting

The post-receive-email example hook includes a description of the
repository taken from $GIT_DIR/description in the emails it sends.
Gitweb also uses that file and assumes it to be UTF-8. When
[i18n] logoutputencoding is not UTF-8, the result is a message
composed with multiple encodings.

This patch teaches post-receive-email to use plumbing where possible
and to explicitly declare what encoding it expects output to use so
the output uses UTF-8 consistently.

Making the email charset configurable is left as an exercise for the
interested reader.

Reported-by: Alexey Shumkin <zapped@mail.ru>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>

See also
https://github.com/siduction/git-latest-tag/
  commit/594fba4f9cce25f6f215d750a1d70d2af48aafcc