From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 562581F487 for ; Sun, 26 Nov 2023 14:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1701008374; bh=2eqGXSCVK9mJuWqegRO6C6UAhcHDSgvZl+4IzLcgRds=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Jh9DikUkZJwgOHcOWEyJBGjWLw7QtdikGWyt4cyavLOdM7+RvlXTTmpeQIrOuGKFQ uXv88bGmB6y7tnzEXdqx82vBw0RIPpfgJj/MSy0ocpHuUNv3mI3Msl6U/tA9o/XqFP 1Jqz/hCQtl8BRf8FbeE84+oq2KyYBsdXTYBu2EBI= From: Eric Wong To: spew@80x24.org Subject: [PATCH 7/7] cindex: set -cfg_f field unconditionally for --show Date: Sun, 26 Nov 2023 14:19:33 +0000 Message-ID: <20231126141933.593525-7-e@80x24.org> In-Reply-To: <20231126141933.593525-1-e@80x24.org> References: <20231126141933.593525-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There's also no need to local-ize the field, since it's not going to hold other references and the CodeSearch* objects are tied to the config file anyways. --- lib/PublicInbox/CodeSearchIdx.pm | 5 ++--- t/cindex-join.t | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index a6cbe0b0..d49e9a8d 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -1131,8 +1131,6 @@ sub init_join_prefork ($) { } split(/,/, join(',', @$subopt)); require PublicInbox::CidxXapHelperAux; require PublicInbox::XapClient; - my $cfg = $self->{-opt}->{-pi_cfg} // die 'BUG: -pi_cfg unset'; - $self->{-cfg_f} = $cfg->{-f} = rel2abs_collapsed($cfg->{-f}); my @unknown; my $pfx = $JOIN{prefixes} // 'patchid'; for (split /\+/, $pfx) { @@ -1223,7 +1221,8 @@ sub cidx_run { # main entry point $PublicInbox::SearchIdx::BATCH_BYTES; local $MAX_SIZE = $self->{-opt}->{max_size}; local $self->{PENDING} = {}; # used by PublicInbox::CidxXapHelperAux - local $self->{-cfg_f}; + my $cfg = $self->{-opt}->{-pi_cfg} // die 'BUG: -pi_cfg unset'; + $self->{-cfg_f} = $cfg->{-f} = rel2abs_collapsed($cfg->{-f}); if (grep { $_ } @{$self->{-opt}}{qw(prune join)}) { require File::Temp; $TMPDIR = File::Temp->newdir('cidx-all-git-XXXX', TMPDIR => 1); diff --git a/t/cindex-join.t b/t/cindex-join.t index 8d0b09d2..323d69c6 100644 --- a/t/cindex-join.t +++ b/t/cindex-join.t @@ -79,4 +79,9 @@ is($out->{join_data}->{dt}->[0], '19700101'.'000000', ok run_script([qw(-cindex -v --all -u --join --show), '-d', $cidxdir], $env, $rdr), 'incremental --join'; +ok run_script([qw(-cindex -v --no-scan --show), + '-d', $cidxdir], $env, $rdr), 'show'; +$out = PublicInbox::Config->json->decode($cout); +is ref($out->{join_data}), 'HASH', 'got hash join data'; +is $cerr, '', 'no warnings or errors in stderr w/ --show'; done_testing;