diff options
author | Eric Wong <e@80x24.org> | 2019-01-01 10:18:46 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-01-02 08:33:35 +0000 |
commit | bd06b22c9fa498d72808cebfa3987718288ce5db (patch) | |
tree | e193ceb2c034b7ec7eb776e8d8331db639ae5df9 /script | |
parent | cf35d38e7f845393659dfce0249a76d529a2c92c (diff) | |
download | public-inbox-bd06b22c9fa498d72808cebfa3987718288ce5db.tar.gz |
No need to reach into PublicInbox::Config internals and iterate through the hashref by hand
Diffstat (limited to 'script')
-rwxr-xr-x | script/public-inbox-index | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/script/public-inbox-index b/script/public-inbox-index index e487e3fe..73ad9bc4 100755 --- a/script/public-inbox-index +++ b/script/public-inbox-index @@ -73,16 +73,14 @@ if (@ARGV) { sub usage { print STDERR "Usage: $usage\n"; exit 1 } usage() unless @dirs; -foreach my $k (keys %$config) { - $k =~ /\Apublicinbox\.([^\.]+)\.mainrepo\z/ or next; - my $name = $1; - my $v = $config->{$k}; +$config->each_inbox(sub { + my ($ibx) = @_; + for my $i (0..$#dirs) { - next if $dirs[$i] ne $v; - my $ibx = $config->lookup_name($name); - $dirs[$i] = $ibx if $ibx; + next if $dirs[$i] ne $ibx->{mainrepo}; + $dirs[$i] = $ibx; } -} +}); foreach my $dir (@dirs) { if (!ref($dir) && -f "$dir/inbox.lock") { # v2 |