Merge branch 'ss/format-patch-use-encode-headers-for-cover-letter'

"git format-patch --encode-email-headers" ignored the option when
preparing the cover letter, which has been corrected.

* ss/format-patch-use-encode-headers-for-cover-letter:
  format-patch: fix ignored encode_email_headers for cover letter
This commit is contained in:
Junio C Hamano 2023-12-09 16:37:49 -08:00
commit 4297485172
2 changed files with 11 additions and 0 deletions

View file

@ -1364,6 +1364,7 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file,
pp.date_mode.type = DATE_RFC2822;
pp.rev = rev;
pp.print_email_subject = 1;
pp.encode_email_headers = rev->encode_email_headers;
pp_user_info(&pp, NULL, &sb, committer, encoding);
prepare_cover_text(&pp, description_file, branch_name, &sb,
encoding, need_8bit_cte);

View file

@ -1906,6 +1906,16 @@ body" &&
grep "^body$" actual
'
test_expect_success 'cover letter with --cover-from-description subject (UTF-8 subject line)' '
test_config branch.rebuild-1.description "Café?
body" &&
git checkout rebuild-1 &&
git format-patch --stdout --cover-letter --cover-from-description subject --encode-email-headers main >actual &&
grep "^Subject: \[PATCH 0/2\] =?UTF-8?q?Caf=C3=A9=3F?=$" actual &&
! grep "Café" actual
'
test_expect_success 'cover letter with format.coverFromDescription = auto (short subject line)' '
test_config branch.rebuild-1.description "config subject