diff options
author | Eric Wong <e@80x24.org> | 2023-10-17 23:37:52 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-18 20:50:24 +0000 |
commit | 19b791f4894efcb6e545a6b51c8147298363358f (patch) | |
tree | 16a806fcb0c8fdaef242a2d268a8b1416809b46f /lib/PublicInbox/LeiALE.pm | |
parent | 35b0f7aa00a24f5d89b1b941ec644327ba074c99 (diff) | |
download | public-inbox-19b791f4894efcb6e545a6b51c8147298363358f.tar.gz |
`readline' ops may not detect errors on partial reads. This saves us some code to reduce cognitive overhead for readers. We'll also support reusing a destination buffers so it can work more nicely with existing code.
Diffstat (limited to 'lib/PublicInbox/LeiALE.pm')
-rw-r--r-- | lib/PublicInbox/LeiALE.pm | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/PublicInbox/LeiALE.pm b/lib/PublicInbox/LeiALE.pm index cc9a2095..b198af1c 100644 --- a/lib/PublicInbox/LeiALE.pm +++ b/lib/PublicInbox/LeiALE.pm @@ -9,7 +9,7 @@ package PublicInbox::LeiALE; use strict; use v5.10.1; use parent qw(PublicInbox::LeiSearch PublicInbox::Lock); -use PublicInbox::Git; +use PublicInbox::Git qw(read_all); use PublicInbox::Import; use PublicInbox::LeiXSearch; use Fcntl qw(SEEK_SET); @@ -54,11 +54,7 @@ sub refresh_externals { $self->git->cleanup; my $lk = $self->lock_for_scope; my $cur_lxs = ref($lxs)->new; - my $orig = do { - local $/; - readline($self->{lockfh}) // - die "readline($self->{lock_path}): $!"; - }; + my $orig = read_all($self->{lockfh}); my $new = ''; my $old = ''; my $gone = 0; @@ -91,8 +87,7 @@ sub refresh_externals { $new = $old = ''; my $f = $self->git->{git_dir}.'/objects/info/alternates'; if (open my $fh, '<', $f) { - local $/; - $old = <$fh> // die "readline($f): $!"; + read_all($fh, -s $fh, \$old); } for my $x (@ibxish) { $new .= $lei->canonpath_harder($x->git->{git_dir})."/objects\n"; |