summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2011-05-26 16:53:38 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-05-26 14:13:38 -0700
commit5b38456ec7bd0229bb35146ab8a905c4b63daeec (patch)
tree5551f430345d99a0e6fe5d707ee7e084ab77c305
parentt: test subject handling in format-patch / am pipeline (diff)
downloadtgif-5b38456ec7bd0229bb35146ab8a905c4b63daeec.tar.xz
mailinfo: always clean up rfc822 header folding
Without the "-k" option, mailinfo will convert a folded subject header like: Subject: this is a subject that doesn't fit on one line into a single line. With "-k", however, we assumed that these newlines were significant and represented something that the sending side would want us to preserve. For messages created by format-patch, this assumption was broken by a1f6baa (format-patch: wrap long header lines, 2011-02-23). For messages sent by arbitrary MUAs, this was probably never a good assumption to make, as they may have been folding subjects in accordance with rfc822's line length recommendations all along. This patch now joins folded lines with a single whitespace character. This treats header folding purely as a syntactic feature of the transport mechanism, not as something that format-patch is trying to tell us about the original subject. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/mailinfo.c2
-rwxr-xr-xt/t4152-am-subjects.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 71e6262a87..bfb32b7233 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -400,7 +400,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
break;
if (strbuf_getline(&continuation, in, '\n'))
break;
- continuation.buf[0] = '\n';
+ continuation.buf[0] = ' ';
strbuf_rtrim(&continuation);
strbuf_addbuf(line, &continuation);
}
diff --git a/t/t4152-am-subjects.sh b/t/t4152-am-subjects.sh
index 7222c06b80..37e5c0361c 100755
--- a/t/t4152-am-subjects.sh
+++ b/t/t4152-am-subjects.sh
@@ -58,7 +58,7 @@ test_expect_success 'long subject preserved (format-patch | am)' '
test_expect_success 'long subject preserved (format-patch -k | am)' '
check_subject long-k
'
-test_expect_failure 'long subject preserved (format-patch -k | am -k)' '
+test_expect_success 'long subject preserved (format-patch -k | am -k)' '
check_subject long-k -k
'