From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, LOTS_OF_MONEY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id A58602023C for ; Tue, 9 Aug 2016 00:22:54 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] searchidx: persist the PublicInbox::Git object Date: Tue, 9 Aug 2016 00:22:51 +0000 Message-Id: <20160809002252.31177-3-e@80x24.org> In-Reply-To: <20160809002252.31177-1-e@80x24.org> References: <20160809002252.31177-1-e@80x24.org> List-Id: We can cheaply keep the object around nowadays since it spawns expensive processes only on an as-needed basis. --- lib/PublicInbox/SearchIdx.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 9a462c7..2c4e704 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -44,6 +44,7 @@ sub new { my $umask = _umask_for($perm); $self->{umask} = $umask; $self->{lock_path} = "$git_dir/ssoma.lock"; + $self->{git} = PublicInbox::Git->new($git_dir); $self->{xdb} = $self->with_umask(sub { if ($writable == 1) { require File::Path; @@ -349,7 +350,7 @@ sub rlog { my $h40 = $hex .'{40}'; my $addmsg = qr!^:000000 100644 \S+ ($h40) A\t${hex}{2}/${hex}{38}$!; my $delmsg = qr!^:100644 000000 ($h40) \S+ D\t${hex}{2}/${hex}{38}$!; - my $git = PublicInbox::Git->new($self->{git_dir}); + my $git = $self->{git}; my $log = $git->popen(qw/log --reverse --no-notes --no-color --raw -r --no-abbrev/, $range); my $latest; -- EW