Skip to content

Commit 5b38456

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 00ebc97 commit 5b38456

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/mailinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ static int read_one_header_line(struct strbuf *line, FILE *in)
400400
break;
401401
if (strbuf_getline(&continuation, in, '\n'))
402402
break;
403-
continuation.buf[0] = '\n';
403+
continuation.buf[0] = ' ';
404404
strbuf_rtrim(&continuation);
405405
strbuf_addbuf(line, &continuation);
406406
}

t/t4152-am-subjects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test_expect_success 'long subject preserved (format-patch | am)' '
5858
test_expect_success 'long subject preserved (format-patch -k | am)' '
5959
check_subject long-k
6060
'
61-
test_expect_failure 'long subject preserved (format-patch -k | am -k)' '
61+
test_expect_success 'long subject preserved (format-patch -k | am -k)' '
6262
check_subject long-k -k
6363
'
6464

0 commit comments

Comments
 (0)