about summary refs log tree commit homepage
path: root/lib/PublicInbox/MailDiff.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-30 11:41:02 +0000
committerEric Wong <e@80x24.org>2023-11-30 21:36:56 +0000
commit646ba6c2e1a21307e03c54341c49188aa1758349 (patch)
treeda5b5679900b94cdadb5345736d33597ce191cfd /lib/PublicInbox/MailDiff.pm
parent8b1e05e5a4dfec73d593a549f7ed0ffae98209fb (diff)
downloadpublic-inbox-646ba6c2e1a21307e03c54341c49188aa1758349.tar.gz
When setting up stdin for commands, the write_file API is
convenient enough nowadays to not be worth having special
support with process spawning.

When reading stdout of commands, we should probably be using
utf8_maybe everywhere since there'll always be legacy encodings
in git repos.

Reading regular files with :utf8 also results in worse memory
management since the file size cannot be used as a hint.
Diffstat (limited to 'lib/PublicInbox/MailDiff.pm')
-rw-r--r--lib/PublicInbox/MailDiff.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/PublicInbox/MailDiff.pm b/lib/PublicInbox/MailDiff.pm
index e4e262ef..125360fe 100644
--- a/lib/PublicInbox/MailDiff.pm
+++ b/lib/PublicInbox/MailDiff.pm
@@ -65,6 +65,7 @@ sub next_smsg ($) {
 sub emit_msg_diff {
         my ($bref, $self) = @_; # bref is `git diff' output
         require PublicInbox::Hval;
+        PublicInbox::Hval::utf8_maybe($$bref);
 
         # will be escaped to `&#8226;' in HTML
         $self->{ctx}->{ibx}->{obfuscate} and
@@ -81,7 +82,7 @@ sub do_diff {
         my $dir = "$self->{tmp}/$n";
         $self->dump_eml($dir, $eml);
         my $cmd = [ qw(git diff --no-index --no-color -- a), $n ];
-        my $opt = { -C => "$self->{tmp}", quiet => 1, 1 => [':utf8', \my $o] };
+        my $opt = { -C => "$self->{tmp}", quiet => 1 };
         my $qsp = PublicInbox::Qspawn->new($cmd, undef, $opt);
         $qsp->psgi_qx($self->{ctx}->{env}, undef, \&emit_msg_diff, $self);
 }