]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: filter out non-existent git directories
authorEric Wong <e@80x24.org>
Tue, 21 Mar 2023 23:07:38 +0000 (23:07 +0000)
committerEric Wong <e@80x24.org>
Sat, 25 Mar 2023 09:37:58 +0000 (09:37 +0000)
We'll just warn them about our non-existent prune support,
for now, and implement --prune in the next commit.

lib/PublicInbox/CodeSearchIdx.pm

index 4f91e0b6b92dabad02a31ad012ec8cc63a30cad6..e875b93eab440a41908ab5420df91c085fe5ffcb 100644 (file)
@@ -547,7 +547,19 @@ sub load_existing ($) { # for -u/--update
                local $self->{xdb};
                $self->xdb or
                        die "E: $self->{cidx_dir} non-existent for --update\n";
-               my @cur = $self->all_terms('P');
+               my @missing;
+               my @cur = grep {
+                       if (-e $_) {
+                               1;
+                       } else {
+                               push @missing, $_;
+                               undef;
+                       }
+               } $self->all_terms('P');
+               @missing and warn "W: the following repos no longer exist:\n",
+                               (map { "W:\t$_\n" } @missing),
+                               "W: use --prune to remove them from ",
+                               $self->{cidx_dir}, "\n";
                push @$dirs, @cur;
        }
        my %uniq; # List::Util::uniq requires Perl 5.26+