From: Junio C Hamano Date: Wed, 22 Aug 2012 18:51:47 +0000 (-0700) Subject: Merge branch 'tr/maint-send-email-2047' X-Git-Tag: v1.8.0-rc0~150 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4692f32ddfb6a633c83d6a731f5a8cfbea218e7c?hp=d0ae7e2e71a6d8b9eb198ed0a5e1462013f7c65d Merge branch 'tr/maint-send-email-2047' "git send-email" did not unquote encoded words that appear on the header correctly, and lost "_" from strings. * tr/maint-send-email-2047: send-email: improve RFC2047 quote parsing --- diff --git a/git-send-email.perl b/git-send-email.perl index ef30c557c7..664713709c 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -862,11 +862,13 @@ sub make_message_id { sub unquote_rfc2047 { local ($_) = @_; my $encoding; - if (s/=\?([^?]+)\?q\?(.*)\?=/$2/g) { + s{=\?([^?]+)\?q\?(.*?)\?=}{ $encoding = $1; - s/_/ /g; - s/=([0-9A-F]{2})/chr(hex($1))/eg; - } + my $e = $2; + $e =~ s/_/ /g; + $e =~ s/=([0-9A-F]{2})/chr(hex($1))/eg; + $e; + }eg; return wantarray ? ($_, $encoding) : $_; } diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 8c12c65c72..035122808b 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -841,6 +841,19 @@ test_expect_success $PREREQ '--compose adds MIME for utf8 subject' ' grep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1 ' +test_expect_success $PREREQ 'utf8 author is correctly passed on' ' + clean_fake_sendmail && + test_commit weird_author && + test_when_finished "git reset --hard HEAD^" && + git commit --amend --author "Füñný Nâmé " && + git format-patch --stdout -1 >funny_name.patch && + git send-email --from="Example " \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + funny_name.patch && + grep "^From: Füñný Nâmé " msgtxt1 +' + test_expect_success $PREREQ 'detects ambiguous reference/file conflict' ' echo master > master && git add master &&