diff options
author | Eric Wong <e@80x24.org> | 2023-11-30 11:41:02 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-30 21:36:56 +0000 |
commit | 646ba6c2e1a21307e03c54341c49188aa1758349 (patch) | |
tree | da5b5679900b94cdadb5345736d33597ce191cfd /lib/PublicInbox/SearchIdx.pm | |
parent | 8b1e05e5a4dfec73d593a549f7ed0ffae98209fb (diff) | |
download | public-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/SearchIdx.pm')
-rw-r--r-- | lib/PublicInbox/SearchIdx.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 17538027..86c435fd 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -355,8 +355,11 @@ sub index_body_text { my $rd; if ($$sref =~ /^(?:diff|---|\+\+\+) /ms) { # start patch-id in parallel my $git = ($self->{ibx} // $self->{eidx} // $self)->git; + my $fh = PublicInbox::IO::write_file '+>:utf8', undef, $$sref; + $fh->flush or die "flush: $!"; + sysseek($fh, 0, SEEK_SET); $rd = popen_rd($git->cmd(qw(patch-id --stable)), undef, - { 0 => [ ':utf8', $sref ] }); + { 0 => $fh }); } # split off quoted and unquoted blocks: |