From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=ALL_TRUSTED,BAYES_00, URIBL_SBL,URIBL_SBL_A shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D2F041F4B4 for ; Tue, 13 Oct 2020 01:34:30 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] admin: preserve config ordering of `--all' switch Date: Tue, 13 Oct 2020 01:34:30 +0000 Message-Id: <20201013013430.13816-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: When `--all' is passed to -index and similar commands, process them in the same order as what is given in the config file. --- lib/PublicInbox/Admin.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm index fb88e621..9d48e5eb 100644 --- a/lib/PublicInbox/Admin.pm +++ b/lib/PublicInbox/Admin.pm @@ -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 <{name} $ibx->{inboxdir}: $! @@ -110,10 +112,9 @@ 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;