git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Shumkin <zapped@mail.ru>
To: git@vger.kernel.org
Cc: Alexey Shumkin <zapped@mail.ru>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v2] post-receive-email: explicitly set Content-Type header
Date: Tue, 20 Sep 2011 12:07:03 +0400	[thread overview]
Message-ID: <1316506023-5098-1-git-send-email-zapped@mail.ru> (raw)
In-Reply-To: <1316505154-3904-1-git-send-email-zapped@mail.ru>

Some email clients (e.g. claws-mail) incorrectly display
message body when there is no Content-Type header and charset
explicitly defined.
So, set explicitly Content-Type header and charset
can be defined with hooks.emailcharset config variable.

Signed-off-by: Alexey Shumkin <zapped@mail.ru>
---
 [resent: Fixed typo in commit message]

 contrib/hooks/post-receive-email |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 21989fc..64d7c2f 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -60,6 +60,8 @@
 #   email body. If not specified, there is no limit.
 #   Lines beyond the limit are suppressed and counted, and a final
 #   line is added indicating the number of suppressed lines.
+# hooks.emailcharset
+#   The charset used in Content-Type header. UTF-8, if not specified.
 #
 # Notes
 # -----
@@ -229,6 +231,7 @@ generate_email_header()
 	cat <<-EOF
 	To: $recipients
 	Subject: ${emailprefix}$projectdesc $refname_type $short_refname ${change_type}d. $describe
+	Content-Type: text/plain; charset=$emailcharset
 	X-Git-Refname: $refname
 	X-Git-Reftype: $refname_type
 	X-Git-Oldrev: $oldrev
@@ -723,6 +726,7 @@ envelopesender=$(git config hooks.envelopesender)
 emailprefix=$(git config hooks.emailprefix || echo '[SCM] ')
 custom_showrev=$(git config hooks.showrev)
 maxlines=$(git config hooks.emailmaxlines)
+emailcharset=$(git config hooks.emailcharset || echo 'UTF-8')
 
 # --- Main loop
 # Allow dual mode: run from the command line just like the update hook, or
-- 
1.7.6.3.4.gf71f

  reply	other threads:[~2011-09-20  8:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  7:52 [PATCH] post-receive-email: explicitly set Content-Type header Alexey Shumkin
2011-09-20  8:07 ` Alexey Shumkin [this message]
2011-09-20  9:32   ` [PATCH v2] " Johannes Sixt
2011-09-20 10:42     ` Shumkin Alexey
2011-09-20 11:10       ` Johannes Sixt
2011-10-07  9:06         ` Jonathan Nieder
2011-10-07 12:52           ` Alexey Shumkin
2011-10-07 20:19             ` Jonathan Nieder
2011-11-09 11:00               ` [PATCH v3] " Alexey Shumkin
2011-11-09 14:11                 ` Junio C Hamano
2011-11-09 15:01                   ` Alexey Shumkin
2011-09-20 12:23       ` [PATCH v2] " Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1316506023-5098-1-git-send-email-zapped@mail.ru \
    --to=zapped@mail.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).