From: Eric Wong Date: Sat, 9 Apr 2016 09:07:16 +0000 (+0000) Subject: import: set binmode before printing author names X-Git-Tag: v1.0.0~611 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=072a8bf4bc83f1e7b7b6f603ef0403a78ce991d1;p=public-inbox.git import: set binmode before printing author names Author names may have wide characters in them, so avoid warnings as git favors UTF-8 for names and fast-import even requires them for commit messages --- diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index e2156f10..4c7bbf14 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -162,11 +162,16 @@ sub add { unless ($parent) { print $w "reset $ref\n" or wfail; } + + # quiet down wide character warnings: + binmode $w, ':utf8' or die "binmode :utf8 failed: $!"; print $w "commit $ref\nmark :$commit\n", "author $name <$email> $date\n", "committer $self->{ident} ", now2822(), "\n", "data ", (length($subject) + 1), "\n", $subject, "\n\n" or wfail; + binmode $w, ':raw' or die "binmode :raw failed: $!"; + if ($tip ne '') { print $w 'from ', ($parent ? $parent : $tip), "\n" or wfail; }