summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00ebc97)
raw | patch | inline | side by side (parent: 00ebc97)
author | Jeff King <peff@peff.net> | |
Thu, 26 May 2011 20:53:38 +0000 (16:53 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 26 May 2011 21:13:38 +0000 (14:13 -0700) |
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>
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>
builtin/mailinfo.c | patch | blob | history | |
t/t4152-am-subjects.sh | patch | blob | history |
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 71e6262a87d883a4a82953db5f742bccf99e5c77..bfb32b7233850a68bdc226038a9c0f973037499b 100644 (file)
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
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 7222c06b803bec2b609e00cb9c75b250ec7867a4..37e5c0361ca84b52d07893e8026410a18b50f356 100755 (executable)
--- a/t/t4152-am-subjects.sh
+++ b/t/t4152-am-subjects.sh
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
'