]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: squelch incompatible options
authorEric Wong <e@80x24.org>
Tue, 21 Mar 2023 23:07:41 +0000 (23:07 +0000)
committerEric Wong <e@80x24.org>
Sat, 25 Mar 2023 09:38:01 +0000 (09:38 +0000)
Some options don't make sense when used together.

lib/PublicInbox/CodeSearchIdx.pm
script/public-inbox-cindex

index 5e6c0d22a0b3d74d0aec020b3d8e4daf7966a7b5..21c43973dd7b479a3c59fc1a029c67f8478c5304 100644 (file)
@@ -734,7 +734,7 @@ sub cidx_run { # main entry point
                        $m =~ s/\A(#?\s*)/$1$self->{current_info}: /;
                $cb->($m, @_);
        };
-       load_existing($self);
+       load_existing($self) unless $self->{-internal};
        local $REINDEX;
        if ($self->{-opt}->{reindex}) {
                require PublicInbox::SharedKV;
index e2500b930ce2d81c7225839af38ffe3622af4f66..f8a3ebbbe809037e2ce564d3a193de1da8096c95 100755 (executable)
@@ -52,6 +52,11 @@ my @git_dirs;
 if (defined(my $pl = $opt->{'project-list'})) {
        my $pfx = shift @ARGV // die <<EOM;
 PROJECTS_ROOT required for --project-list
+EOM
+       @ARGV and die <<EOM;
+--project-list does not accept additional directories
+(@ARGV)
+beyond `$pfx'
 EOM
        open my $fh, '<', $pl or die "open($pl): $!\n";
        chomp(@git_dirs = <$fh>);
@@ -67,6 +72,9 @@ if (defined $cidx_dir) { # external index
 } elsif (!@git_dirs) {
        die $help
 } else {
+       die <<EOM if $opt->{update};
+--update requires `-d EXTDIR'
+EOM
        for my $gd (@git_dirs) {
                my $cd = "$gd/public-inbox-cindex";
                my $cidx = PublicInbox::CodeSearchIdx->new($cd, { %$opt });