]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extindex: do not use current dir like -index does
authorEric Wong <e@80x24.org>
Tue, 8 Dec 2020 21:21:28 +0000 (21:21 +0000)
committerEric Wong <e@80x24.org>
Wed, 9 Dec 2020 21:13:35 +0000 (21:13 +0000)
At least not for resolving inboxes, since there's no good way
for a user to specify what is an inbox or extindex directory
without a command-line switch.

Instead of changing the -extindex command, we change the -index
command internals to rely on the new {-use_cwd} flag to avoid
internal use of negation, since double-negatives and the like
are confusing to me.

lib/PublicInbox/Admin.pm
script/public-inbox-index

index 9d48e5ebee4131553e6442e135d7a0d642e55b58..ec80b56562c62d246895057a10ab7f22ef673cd1 100644 (file)
@@ -118,7 +118,7 @@ EOF
        } else { # directories specified on the command-line
                my $i = 0;
                my @dirs = @$argv;
-               push @dirs, '.' unless @dirs;
+               push @dirs, '.' if !@dirs && $opt->{-use_cwd};
                foreach (@dirs) {
                        my $v;
                        my $dir = resolve_repo_dir($_, \$v);
index 5909801e7a3ad760fb714b9f5d397f7d0cf47820..8a61817ce7f012401b9c606f3c54ff7519263c8d 100755 (executable)
@@ -51,6 +51,7 @@ require PublicInbox::Admin;
 PublicInbox::Admin::require_or_die('-index');
 
 my $cfg = PublicInbox::Config->new; # Config is loaded by Admin
+$opt->{-use_cwd} = 1;
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
 PublicInbox::Admin::require_or_die('-index');
 unless (@ibxs) { print STDERR $help; exit 1 }