]> Sergey Matveev's repositories - public-inbox.git/commitdiff
import: set binmode before printing author names
authorEric Wong <e@80x24.org>
Sat, 9 Apr 2016 09:07:16 +0000 (09:07 +0000)
committerEric Wong <e@80x24.org>
Mon, 11 Apr 2016 04:57:53 +0000 (04:57 +0000)
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

lib/PublicInbox/Import.pm

index e2156f1040f22f17e20e686e0f2ca57a6fec8b4b..4c7bbf14678342e2eeaf70af358afa671b822964 100644 (file)
@@ -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;
        }