From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Samuel Tardieu <sam@rfc1149.net>, git@vger.kernel.org
Subject: Re: [PATCH] Add MIME information to outgoing email
Date: Fri, 14 Mar 2008 09:20:09 -0700 [thread overview]
Message-ID: <7v4pb9qnuu.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080313170016.GA3439@sigill.intra.peff.net
Jeff King <peff@peff.net> writes:
> On Thu, Mar 13, 2008 at 05:40:19PM +0100, Samuel Tardieu wrote:
>
>> Add MIME-Version/Content-Type/Content-Transfer-Encoding headers in
>> messages generated with git-format-patch. Without it, messages generated
>> without using --attach or --inline didn't have any content type information.
>>
>> I got hit with this problem yesterday when sending a patch to linux-kernel
>> with a commit message containing the name "Pádraig" in it. Moreover,
>> the mailing-list software added an incorrect ISO-8859-1 encoding information
>> which mangled Pádraig's name.
>
> It's supposed to handle this automatically if the commit message
> contains non-ascii characters. What version of git were you using?
You are right. The call-chain looks like this:
log_tree_diff_flush()
show_log()
log_write_email_headers() writes mbox From
pretty_print_commit()
check commit log if it is pure ascii
pp_header()
pp_user_info() writes RFC2822 From:
pp_title_line() writes RFC2822 Subject:
writes MIME-Version: and friends if needed
pp_remainder() writes the remainder of the log message
append_signoff()
printf("---\n")
diff_flush() writes the patch
At the beginning of pretty_print_commit() we look at the log and if it is
not ascii we pass that information down to pp_title_line() which is
responsible for writing MIME header at the appropriate place.
If your patch itself has some non-ASCII material, and if your commit log
message is pure ASCII, the above would end up not writing MIME at all. If
your commit log message is non ASCII, then we will mark it as if the
entire message is in the encoding of the log in pp_title_line(). This
might look like a problem, but it is not something non multipart output of
format-patch should even try to cater to. The payload (i.e. the patch)
out of git has always been uninterpreted sequence of bytes (and it is not
going to change).
A patch to i18n po/ files for example could contain patches to different
files encoded in KOI-8, BIG5, EUC-JP and UTF-8 at the same time. There is
no way to say "text/plain; charset=X" for such a payload (because there is
no single charset used in such a patch), and git simply does not know nor
care about what encoding each file is in. The output from git marks only
the part git knows the encoding about (i.e. the commit log message).
Having said all that, I notice that addition of format.headers variable
(which I think is a later invention) was done not quite correctly. In the
callchain above, pretty_print_commit() function checks the commit log but
it is meant to do so only when we haven't emitted MIME Content-Type:
(because the user told us to do multipart), and "after_subject" parameter
was getting passed around for it (and its callees) to detect exactly that.
But format.headers misused that variable to carry its contents along ---
there needs a way to pass "have we said MIME-Version crap already"
separately.
next prev parent reply other threads:[~2008-03-14 16:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 16:40 [PATCH] Add MIME information to outgoing email Samuel Tardieu
2008-03-13 17:00 ` Jeff King
2008-03-13 17:14 ` Samuel Tardieu
2008-03-14 13:29 ` Jeff King
2008-03-14 13:40 ` Samuel Tardieu
2008-03-14 13:46 ` Jeff King
2008-03-14 13:50 ` Samuel Tardieu
2008-03-14 14:35 ` Jeff King
2008-03-14 14:40 ` Samuel Tardieu
2008-03-14 16:20 ` Junio C Hamano [this message]
2008-03-14 20:21 ` Re* " Junio C Hamano
2008-03-14 21:27 ` Jeff King
2008-03-13 18:48 ` Junio C Hamano
2008-03-13 19:05 ` Samuel Tardieu
2008-03-14 11:21 ` Brian Swetland
2008-03-14 11:57 ` Samuel Tardieu
2008-03-25 18:31 ` MIME headers in introductory message (git send-email --compose) Teemu Likonen
2008-03-25 19:17 ` Jay Soffian
2008-03-25 20:47 ` Junio C Hamano
2008-03-25 20:59 ` Jay Soffian
2008-03-25 21:56 ` Jeff King
2008-03-25 22:07 ` Jeff King
2008-03-25 23:06 ` Jeff King
2008-03-26 2:46 ` Jay Soffian
2008-04-10 18:47 ` Jan Hudec
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=7v4pb9qnuu.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=sam@rfc1149.net \
/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).