Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-02-23 12:59:18 +0300
committerJunio C Hamano <gitster@pobox.com>2011-02-24 03:09:33 +0300
commitc22e7de340df2e0ebc0e98347aa02a32a459835f (patch)
treeb98a81273f1bf5653b3e1cfd5ef7aff5c5f9b680 /pretty.c
parenta1f6baa5c97abc8b579fa7ac7c4dc21971bdc048 (diff)
format-patch: rfc2047-encode newlines in headers
These should generally never happen, as we already concatenate multiples in subjects into a single line. But let's be defensive, since not encoding them means we will output malformed headers. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pretty.c b/pretty.c
index 0e167f463f..65d20a7a2e 100644
--- a/pretty.c
+++ b/pretty.c
@@ -228,7 +228,7 @@ static void add_rfc2047(struct strbuf *sb, const char *line, int len,
for (i = 0; i < len; i++) {
int ch = line[i];
- if (non_ascii(ch))
+ if (non_ascii(ch) || ch == '\n')
goto needquote;
if ((i + 1 < len) && (ch == '=' && line[i+1] == '?'))
goto needquote;
@@ -254,7 +254,7 @@ needquote:
* many programs do not understand this and just
* leave the underscore in place.
*/
- if (is_rfc2047_special(ch) || ch == ' ') {
+ if (is_rfc2047_special(ch) || ch == ' ' || ch == '\n') {
strbuf_addf(sb, "=%02X", ch);
line_len += 3;
}