unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] cindex: --prune + --exclude= drops repo information
Date: Wed,  3 May 2023 11:42:15 +0000	[thread overview]
Message-ID: <20230503114215.3414226-1-e@80x24.org> (raw)

--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 <<EOM;
-W: no docids for `$p' [$self->{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} ||

                 reply	other threads:[~2023-05-03 11:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230503114215.3414226-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).