summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-04-14 18:18:09 -0400
committerJunio C Hamano <gitster@pobox.com>2011-04-14 15:42:04 -0700
commit990f6e30eb00adeb8cad75c3be34c0fc9ff6abb0 (patch)
tree685bbcb7ee8cebd6facdbad4cafa0268077b49cb /t/t4014-format-patch.sh
parentc22e7de340df2e0ebc0e98347aa02a32a459835f (diff)
downloadgit-990f6e30eb00adeb8cad75c3be34c0fc9ff6abb0.tar.gz
format-patch: wrap email addresses after long names
We already wrap names in "from" headers, which tend to be the long part of an address. But it's also possible for a long name to not be wrapped, but to make us want to wrap the email address. For example (imagine for the sake of readability we want to wrap at 50 characters instead of 78): From: this is my really long git name <foo@example.com> The name does not overflow the line, but the name and email together do. So we would rather see: From: this is my really long git name <git@example.com> Because we wrap the name separately during add_rfc2047, we neglected this case. Instead, we should see how long the final line of the wrapped name ended up, and decide whether or not to wrap based on that. We can't break the address into multiple parts, so we either leave it with the name, or put it by itself on a line. Test by Erik Faye-Lund. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 9c663677df..9f64a4e2a1 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: $M64
+ <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