diff options
author | Eric Wong <e@80x24.org> | 2018-05-11 19:20:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-05-11 19:23:08 +0000 |
commit | 9814b8f8f9a2231004f4bf2760eea69cb28b9fcc (patch) | |
tree | e9c919cead8708fd17ef2043b9b279f4dd9a1bef /script/public-inbox-compact | |
parent | 949572dc9d547b2eb5c7cb268551524a36ff28c3 (diff) | |
download | public-inbox-9814b8f8f9a2231004f4bf2760eea69cb28b9fcc.tar.gz |
Some users may not have any public-inboxes configured, especially in tests.
Diffstat (limited to 'script/public-inbox-compact')
-rwxr-xr-x | script/public-inbox-compact | 10 |
1 files changed, 6 insertions, 4 deletions
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"; |