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 370D61F452 for ; Wed, 3 May 2023 11:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1683114135; bh=JVvTTdZGNmRNZGiGuoILlZDhvnNfMKJcau6fBzVhLok=; h=From:To:Subject:Date:From; b=2EktpaVGJJVCp2X/f+5RehqLM2WyYXtwuMmeselbFqm9ZlWobNhehSGeXa51bNwVa jYZLeDmED6yYF9l1oFTYKakXT0Mro7RgFblYRC0EUlymiqK8kc23YV7QXujxLSZcS9 jxneRQGFKj6Xvy8QwuifnnJMtYkzcFIyLTsJ9hzw= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] cindex: --prune + --exclude= drops repo information Date: Wed, 3 May 2023 11:42:15 +0000 Message-Id: <20230503114215.3414226-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --exclude= alone only prevents a coderepo from being indexed in a particular invocation, but --prune will purge all traces of it to ensure --update doesn't pick it up again w/o --exclude= (unless --project-list= includes it). --- lib/PublicInbox/CodeSearchIdx.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 671134bf..d92d87fc 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -648,9 +648,7 @@ sub prune_do { # via wq_io_do in IDX_SHARDS local $/ = "\0"; while (my $p = <$gone>) { # Q$cmt or P$git_dir chomp $p; - my @docids = docids_by_postlist($self, $p) or warn <{shard}] -EOM + my @docids = docids_by_postlist($self, $p); for (@docids) { $TXN_BYTES -= $xdb->get_doclength($_) * 42; $xdb->delete_document($_); @@ -914,9 +912,13 @@ sub cidx_run { # main entry point my $re = '(?:'.join('\\z|', map { glob2re($_) // qr/\A\Q$_\E/ } @$excl).'\\z)'; + my @excl; @{$self->{git_dirs}} = grep { - $_ =~ /$re/ ? (warn("# excluding $_\n"), 0) : 1; + $_ =~ /$re/ ? (push(@excl, $_), 0) : 1; } @{$self->{git_dirs}}; + warn("# excluding $_\n") for @excl; + my %uniq; # List::Util::uniq requires Perl 5.26+ + @GIT_DIR_GONE = grep { !$uniq{$_}++ } (@GIT_DIR_GONE, @excl); } local $NCHANGE = 0; local $LIVE_JOBS = $self->{-opt}->{jobs} ||