]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Admin.pm
extindex: do not use current dir like -index does
[public-inbox.git] / lib / PublicInbox / Admin.pm
index b8ead6f703984153712640cd1af6928a5c0d060c..ec80b56562c62d246895057a10ab7f22ef673cd1 100644 (file)
@@ -97,12 +97,14 @@ sub resolve_inboxes ($;$$) {
        my $min_ver = $opt->{-min_inbox_version} || 0;
        my (@old, @ibxs);
        my %dir2ibx;
+       my $all = $opt->{all} ? [] : undef;
        if ($cfg) {
                $cfg->each_inbox(sub {
                        my ($ibx) = @_;
                        my $path = abs_path($ibx->{inboxdir});
                        if (defined($path)) {
                                $dir2ibx{$path} = $ibx;
+                               push @$all, $ibx if $all;
                        } else {
                                warn <<EOF;
 W: $ibx->{name} $ibx->{inboxdir}: $!
@@ -110,14 +112,13 @@ EOF
                        }
                });
        }
-       if ($opt->{all}) {
-               my @all = values %dir2ibx;
-               @all = grep { $_->version >= $min_ver } @all;
-               push @ibxs, @all;
+       if ($all) {
+               @$all = grep { $_->version >= $min_ver } @$all;
+               @ibxs = @$all;
        } 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);
@@ -131,7 +132,7 @@ EOF
                }
        }
        if (@old) {
-               die "inboxes $min_ver inboxes not supported by $0\n\t",
+               die "-V$min_ver inboxes not supported by $0\n\t",
                    join("\n\t", @old), "\n";
        }
        @ibxs;