git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
FEFabian Emmes <emmes@informatik.rwth-aachen.de>
Date
Jul 30, 2009, 08:02 UTC
Message-ID
<20090730080206.GR31428@hebe.informatik.RWTH-Aachen.DE>
In-Reply-To
<20090729144610.GA5060@coredump.intra.peff.net>
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:
Show 43 quoted lines
> 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
Previous: Jeff KingNext: Jeff King
Message 4 of 5 in “post-receive-email: Set content-type and encoding in generated mail”
  1. post-receive-email: Set content-type and encoding in generated mailFabian Emmes, Jul 29, 2009
  2. Teemu LikonenJul 29, 2009
  3. Jeff KingJul 29, 2009
  4. Fabian EmmesJul 30, 2009
  5. Jeff KingJul 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.