unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] admin: preserve config ordering of `--all' switch
Date: Tue, 13 Oct 2020 01:34:30 +0000	[thread overview]
Message-ID: <20201013013430.13816-1-e@80x24.org> (raw)

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 <<EOF;
 W: $ibx->{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;

             reply	other threads:[~2020-10-13  1:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13  1:34 Eric Wong [this message]
2020-10-13  7:19 ` [PATCH] admin: preserve config ordering of `--all' switch Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201013013430.13816-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).