[BUG] format-patch does not wrap From-field after author name

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

 



With certain combinations of author name and email lengths, git
format-patch does not correctly wrap the From line to be below 78
characters, violating rfc2047.

This happens because pp_user_info in pretty.c use add_rfc2047 (which
wraps) for the name, but strbuf_add (which does not wrap) for the
email part.

Here's a test that illustrate the problem:

diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 9c66367..a4b8b59 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -793,4 +793,19 @@ test_expect_success 'format-patch wraps extremely
long headers (rfc2047)' '
 	test_cmp expect subject
 '

+M8="foo_bar_"
+M64=$M8$M8$M8$M8$M8$M8$M8$M8
+cat >expect <<'EOF'
+From: foo_bar_foo_bar_foo_bar_foo_bar_foo_bar_foo_bar_foo_bar_foo_bar
+ <foobar@xxxxxxx>
+EOF
+test_expect_success 'format-patch wraps non-quotable headers' '
+	rm -rf patches/ &&
+	echo content >>file &&
+	git add file &&
+	git commit -mfoo --author "$M64 <foobar@xxxxxxx>" &&
+	git format-patch --stdout -1 >patch &&
+	sed -n "/^From: /p; /^ /p; /^$/q" <patch >from &&
+	test_cmp expect from
+'
 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]