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
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 ` 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

unofficial mirror of meta@public-inbox.org

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://yhetil.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.mail.public-inbox.meta
	nntp://news.public-inbox.org/inbox.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git