format-patch: wrap long header lines
commita1f6baa5c97abc8b579fa7ac7c4dc21971bdc048
authorJeff King <peff@peff.net>
Wed, 23 Feb 2011 09:58:41 +0000 (23 04:58 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Feb 2011 21:46:33 +0000 (23 13:46 -0800)
treed5deba6b602e562ffcd2e039b86d485a6cffb79f
parent98acc837a14c2ab1975b38b93cb028e87e47ad4a
format-patch: wrap long header lines

Subject and identity headers may be arbitrarily long. In the
past, we just assumed that single-line headers would be
reasonably short. For multi-line subjects that we squish
into a single line, we just "pre-folded" the data in
pp_title_line by adding a newline and indentation.

There were two problems. One is that, although rare,
single-line messages can actually be longer than the
recommended line-length limits. The second is that the
pre-folding interacted badly with rfc2047 encoding, leading
to malformed headers.

Instead, let's stop pre-folding the subject lines, and just
fold everything based on length in add_rfc2047, whether
it is encoded or not.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c
t/t4014-format-patch.sh