git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] format-patch does not wrap From-field after author name
@ 2011-04-14 17:01 Erik Faye-Lund
  2011-04-14 17:12 ` Junio C Hamano
  2011-04-14 17:52 ` Jeff King
  0 siblings, 2 replies; 15+ messages in thread
From: Erik Faye-Lund @ 2011-04-14 17:01 UTC (permalink / raw)
  To: Git Mailing List

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@foo.bar>
+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@foo.bar>" &&
+	git format-patch --stdout -1 >patch &&
+	sed -n "/^From: /p; /^ /p; /^$/q" <patch >from &&
+	test_cmp expect from
+'
 test_done

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-04-16  1:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-14 17:01 [BUG] format-patch does not wrap From-field after author name Erik Faye-Lund
2011-04-14 17:12 ` Junio C Hamano
2011-04-14 17:50   ` Jeff King
2011-04-14 21:19     ` Erik Faye-Lund
2011-04-14 21:42       ` Jeff King
2011-04-14 22:18         ` Jeff King
2011-04-14 22:21         ` Erik Faye-Lund
2011-04-14 22:29           ` Jeff King
2011-04-14 22:43             ` Erik Faye-Lund
2011-04-15  3:30               ` Jeff King
2011-04-15  8:32                 ` Erik Faye-Lund
2011-04-16  1:45                   ` Jeff King
2011-04-14 17:52 ` Jeff King
2011-04-14 21:06   ` Erik Faye-Lund
2011-04-14 21:07   ` Erik Faye-Lund

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).