return unless -d $git_dir;
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
- # no cleanup needed, we never cat-file off this, only clone
+ # caller must manually cleanup when done
$g;
};
}
sub try_cat {
my ($path) = @_;
- my $rv = '';
- if (open(my $fh, '<', $path)) {
- local $/;
- $rv = <$fh>;
- }
- $rv;
+ open(my $fh, '<', $path) or return '';
+ local $/;
+ <$fh> // '';
}
sub cat_desc ($) {
my ($self) = @_;
check_inodes($self);
my $subs = $self->{unlock_subs} or return;
- for (values %$subs) {
- eval { $_->on_inbox_unlock($self) };
+ for my $obj (values %$subs) {
+ eval { $obj->on_inbox_unlock($self) };
warn "E: $@ ($self->{inboxdir})\n" if $@;
}
}