]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiStore.pm
treewide: reduce load_xapian* callsites
[public-inbox.git] / lib / PublicInbox / LeiStore.pm
index c8b9d75e909cab717ec58ebc05fb4906c53d7da5..a3decf5fe74e67be609320250718c9949808454f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Local storage (cache/memo) for lei(1), suitable for personal/private
@@ -24,10 +24,7 @@ sub new {
        my (undef, $dir, $opt) = @_;
        my $eidx = PublicInbox::ExtSearchIdx->new($dir, $opt);
        my $self = bless { priv_eidx => $eidx }, __PACKAGE__;
-       if ($opt->{creat}) {
-               PublicInbox::SearchIdx::load_xapian_writable();
-               eidx_init($self);
-       }
+       eidx_init($self) if $opt->{creat};
        $self;
 }
 
@@ -54,7 +51,9 @@ sub git_epoch_max  {
 
 sub git_ident ($) {
        my ($git) = @_;
-       chomp(my $i = $git->qx(qw(var GIT_COMMITTER_IDENT)));
+       open my $null, '>', '/dev/null' or die "open /dev/null: $!";
+       my $opt = { 2 => $null };
+       chomp(my $i = $git->qx(qw(var GIT_COMMITTER_IDENT), undef, $opt));
        warn "$git->{git_dir} GIT_COMMITTER_IDENT failed\n" if $?;
        $i =~ /\A(.+) <([^>]+)> [0-9]+ [-\+]?[0-9]+$/ ? ($1, $2) :
                ('lei user', 'x@example.com')