Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 29, 2009 at 03:48:24PM +0200, Fabian Emmes wrote:

> --- a/contrib/hooks/post-receive-email
> +++ b/contrib/hooks/post-receive-email
> @@ -197,6 +197,7 @@ generate_email_header()
>  	cat <<-EOF
>  	To: $recipients
>  	Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
> +	Content-Type: text/plain; charset=utf-8
>  	X-Git-Refname: $refname
>  	X-Git-Reftype: $refname_type
>  	X-Git-Oldrev: $oldrev

Shouldn't this be $(git config i18n.logOutputEncoding), since you will
be inserting the output of git rev-list into the mail?

And as Teemu mentioned, you need a mime-version and a transfer-encoding
header, as well.

So maybe (totally untested):

---
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 2a66063..0c1c6ad 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -192,11 +192,16 @@ generate_email()
 
 generate_email_header()
 {
+	encoding=`git config i18n.logOutputEncoding`
+	test -z "$encoding" && encoding=utf-8
 	# --- Email (all stdout will be the email)
 	# Generate header
 	cat <<-EOF
 	To: $recipients
 	Subject: ${emailprefix}$projectdesc $refname_type, $short_refname, ${change_type}d. $describe
+	MIME-Version: 1.0
+	Content-Type: text/plain; charset=$encoding
+	Content-Transfer-Encoding: 8bit
 	X-Git-Refname: $refname
 	X-Git-Reftype: $refname_type
 	X-Git-Oldrev: $oldrev
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]