git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] post-receive-email: Set content-type and encoding in generated mail
@ 2009-07-29  9:43 Fabian Emmes
  0 siblings, 0 replies; 6+ messages in thread
From: Fabian Emmes @ 2009-07-29  9:43 UTC (permalink / raw)
  To: git; +Cc: Fabian Emmes

Add proper content-type header to mails generated by post-receive-email, as
suggested by Alexander Gerasiov in
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg588535.html

Signed-off-by: Fabian Emmes <emmes@informatik.rwth-aachen.de>
---
 contrib/hooks/post-receive-email |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 2a66063..0c50155 100755
--- 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
-- 
1.6.3.1.9.g95405b

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] post-receive-email: Set content-type and encoding in generated mail
@ 2009-07-29 13:48 Fabian Emmes
  2009-07-29 14:00 ` Teemu Likonen
  2009-07-29 14:46 ` Jeff King
  0 siblings, 2 replies; 6+ messages in thread
From: Fabian Emmes @ 2009-07-29 13:48 UTC (permalink / raw)
  To: git; +Cc: Fabian Emmes

Add proper content-type header to mails generated by post-receive-email, as
suggested by Alexander Gerasiov in
http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg588535.html

Signed-off-by: Fabian Emmes <emmes@informatik.rwth-aachen.de>
---
 contrib/hooks/post-receive-email |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 2a66063..0c50155 100755
--- 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
-- 
1.6.3.1.9.g95405b

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail
  2009-07-29 13:48 [PATCH] post-receive-email: Set content-type and encoding in generated mail Fabian Emmes
@ 2009-07-29 14:00 ` Teemu Likonen
  2009-07-29 14:46 ` Jeff King
  1 sibling, 0 replies; 6+ messages in thread
From: Teemu Likonen @ 2009-07-29 14:00 UTC (permalink / raw)
  To: Fabian Emmes; +Cc: git

On 2009-07-29 15:48 (+0200), Fabian Emmes wrote:

> Add proper content-type header to mails generated by post-receive-email, as
> suggested by Alexander Gerasiov in
> http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg588535.html
>
> Signed-off-by: Fabian Emmes <emmes@informatik.rwth-aachen.de>
> ---
>  contrib/hooks/post-receive-email |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
> index 2a66063..0c50155 100755
> --- 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

That's not complete. You need all these:

    MIME-Version: 1.0
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: 8bit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail
  2009-07-29 13:48 [PATCH] post-receive-email: Set content-type and encoding in generated mail Fabian Emmes
  2009-07-29 14:00 ` Teemu Likonen
@ 2009-07-29 14:46 ` Jeff King
  2009-07-30  8:02   ` Fabian Emmes
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff King @ 2009-07-29 14:46 UTC (permalink / raw)
  To: Fabian Emmes; +Cc: git

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail
  2009-07-29 14:46 ` Jeff King
@ 2009-07-30  8:02   ` Fabian Emmes
  2009-07-31  1:52     ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Fabian Emmes @ 2009-07-30  8:02 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 2052 bytes --]

Hi,

thanks Teemu and Jeff for correcting the errors. Indeed I assumed that
git log would always output UTF-8 and a "Content-Type" header would be
valid on its own. The patch of Jeff solves my problem. I tested the
results in mutt, kmail and thunderbird.

Regards,
Fabian

On 29. Jul, 10:46, Jeff King wrote:
> 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

-- 
Fabian Emmes           mailto:emmes@informatik.rwth-aachen.de
LuFG Informatik 2      http://verify.rwth-aachen.de/emmes/
RWTH Aachen            phone: +49 241 80-21241

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] post-receive-email: Set content-type and encoding in generated mail
  2009-07-30  8:02   ` Fabian Emmes
@ 2009-07-31  1:52     ` Jeff King
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2009-07-31  1:52 UTC (permalink / raw)
  To: Fabian Emmes; +Cc: git

On Thu, Jul 30, 2009 at 10:02:06AM +0200, Fabian Emmes wrote:

> thanks Teemu and Jeff for correcting the errors. Indeed I assumed that
> git log would always output UTF-8 and a "Content-Type" header would be
> valid on its own. The patch of Jeff solves my problem. I tested the
> results in mutt, kmail and thunderbird.

Great. Would you mind re-submitting the patch you tested with a
proper write-up in the commit message?

-Peff

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-31  1:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29 13:48 [PATCH] post-receive-email: Set content-type and encoding in generated mail Fabian Emmes
2009-07-29 14:00 ` Teemu Likonen
2009-07-29 14:46 ` Jeff King
2009-07-30  8:02   ` Fabian Emmes
2009-07-31  1:52     ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2009-07-29  9:43 Fabian Emmes

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).