unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] cindex: --prune + --exclude= drops repo information
@ 2023-05-03 11:42 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-05-03 11:42 UTC (permalink / raw)
  To: meta

--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} ||

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-03 11:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 11:42 [PATCH] cindex: --prune + --exclude= drops repo information Eric Wong

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).