Re: Re* [PATCH] Add MIME information to outgoing email

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

 



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="はまの ふにおう瘢雹" \
+	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
--
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]

  Powered by Linux