From 9814b8f8f9a2231004f4bf2760eea69cb28b9fcc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 11 May 2018 19:20:16 +0000 Subject: convert+compact: fix when running without ~/.public-inbox/config Some users may not have any public-inboxes configured, especially in tests. --- script/public-inbox-compact | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'script/public-inbox-compact') diff --git a/script/public-inbox-compact b/script/public-inbox-compact index 5f18497e..d22e4032 100755 --- a/script/public-inbox-compact +++ b/script/public-inbox-compact @@ -13,12 +13,14 @@ use File::Path qw(remove_tree); use PublicInbox::Spawn qw(spawn); my $usage = "Usage: public-inbox-compact REPO_DIR\n"; my $dir = shift or die $usage; -my $config = PublicInbox::Config->new; +my $config = eval { PublicInbox::Config->new }; my $ibx; $dir = abs_path($dir); -$config->each_inbox(sub { - $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir -}); +if ($config) { + $config->each_inbox(sub { + $ibx = $_[0] if abs_path($_[0]->{mainrepo}) eq $dir + }); +} unless ($ibx) { warn "W: $dir not configured in ". PublicInbox::Config::default_file() . "\n"; -- cgit v1.2.3-24-ge0c7