From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Samuel Tardieu <sam@rfc1149.net>, git@vger.kernel.org
Subject: Re: Re* [PATCH] Add MIME information to outgoing email
Date: Fri, 14 Mar 2008 17:27:07 -0400 [thread overview]
Message-ID: <20080314212707.GA1027@coredump.intra.peff.net> (raw)
In-Reply-To: <7vbq5hoy48.fsf_-_@gitster.siamese.dyndns.org>
On Fri, Mar 14, 2008 at 01:21:27PM -0700, Junio C Hamano wrote:
> I think the real culprit was the way the "after_subject" was added to the
> callchain (it had loaded semantics -- "here is what we want to say after
> emitting Subject: line" and "have we done any MIME yet?"), not the poor
> guy who did format.headers.
>
> In any case, this patch would hopefully separate the two. The old
> "plain_non_ascii" parameter is now need_8bit_ct_header and now can have
> one of three values:
I was just about to submit a patch splitting after_subject into
"mime_headers" and "extra_headers".
I noticed another bug while doing mine: we are sometimes not strict
_enough_ in squelching headers. A patch made with "-s --attach" when the
signoff has non-ascii characters would end up with duplicated MIME
headers. Your patch handles this fine.
I think your approach is a little nicer. Here is the test case I wrote
for my patch. It covers the original problem and the one I mentioned
above; both fail with current master but pass with your patch.
---
diff --git a/t/t4021-format-patch-signer-mime.sh b/t/t4021-format-patch-signer-mime.sh
index 67a70fa..9bc47a5 100755
--- a/t/t4021-format-patch-signer-mime.sh
+++ b/t/t4021-format-patch-signer-mime.sh
@@ -38,5 +38,13 @@ test_expect_success 'format with non ASCII signer name' '
'
+test_expect_success 'attach and signoff do not duplicate mime headers' '
+
+ GIT_COMMITTER_NAME="^[$B$O$^$N^[(B ^[$B$U$K$*$&^[(B" \
+ git format-patch -s --stdout -1 --attach >output &&
+ test `grep -ci ^MIME-Version: output` = 1
+
+'
+
test_done
diff --git a/t/t4028-format-patch-mime-headers.sh b/t/t4028-format-patch-mime-headers.sh
new file mode 100755
index 0000000..204ba67
--- /dev/null
+++ b/t/t4028-format-patch-mime-headers.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+test_description='format-patch mime headers and extra headers do not conflict'
+. ./test-lib.sh
+
+test_expect_success 'create commit with utf-8 body' '
+ echo content >file &&
+ git add file &&
+ git commit -m one &&
+ echo more >>file &&
+ git commit -a -m "two
+
+ utf-8 body: ñ"
+'
+
+test_expect_success 'patch has mime headers' '
+ rm -f 0001-two.patch &&
+ git format-patch HEAD^ &&
+ grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
+'
+
+test_expect_success 'patch has mime and extra headers' '
+ rm -f 0001-two.patch &&
+ git config format.headers "x-foo: bar" &&
+ git format-patch HEAD^ &&
+ grep -i "x-foo: bar" 0001-two.patch &&
+ grep -i "content-type: text/plain; charset=utf-8" 0001-two.patch
+'
+
+test_done
next prev parent reply other threads:[~2008-03-14 21:27 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
2008-03-14 20:21 ` Re* " Junio C Hamano
2008-03-14 21:27 ` Jeff King [this message]
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=20080314212707.GA1027@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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).