Skip to content

Commit 219d54a

Browse files
emersiongitster
authored andcommitted
format-patch: fix ignored encode_email_headers for cover letter
When writing the cover letter, the encode_email_headers option was ignored. That is, UTF-8 subject lines and email addresses were written out as-is, without any Q-encoding, even if --encode-email-headers was passed on the command line. This is due to encode_email_headers not being copied over from struct rev_info to struct pretty_print_context. Fix that and add a test. Signed-off-by: Simon Ser <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dadef80 commit 219d54a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

builtin/log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,6 +1364,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
13641364
pp.date_mode.type = DATE_RFC2822;
13651365
pp.rev = rev;
13661366
pp.print_email_subject = 1;
1367+
pp.encode_email_headers = rev->encode_email_headers;
13671368
pp_user_info(&pp, NULL, &sb, committer, encoding);
13681369
prepare_cover_text(&pp, description_file, branch_name, &sb,
13691370
encoding, need_8bit_cte);

t/t4014-format-patch.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,16 @@ body" &&
19061906
grep "^body$" actual
19071907
'
19081908

1909+
test_expect_success 'cover letter with --cover-from-description subject (UTF-8 subject line)' '
1910+
test_config branch.rebuild-1.description "Café?
1911+
1912+
body" &&
1913+
git checkout rebuild-1 &&
1914+
git format-patch --stdout --cover-letter --cover-from-description subject --encode-email-headers main >actual &&
1915+
grep "^Subject: \[PATCH 0/2\] =?UTF-8?q?Caf=C3=A9=3F?=$" actual &&
1916+
! grep "Café" actual
1917+
'
1918+
19091919
test_expect_success 'cover letter with format.coverFromDescription = auto (short subject line)' '
19101920
test_config branch.rebuild-1.description "config subject
19111921

0 commit comments

Comments
 (0)