]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-compact
doc: document the reason for --no-renumber
[public-inbox.git] / script / public-inbox-compact
index 5f18497e6b57558963e30562565d3c2798836202..395eec37a4cff439cc2d1db1afbac81e9fb2fa95 100755 (executable)
@@ -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";
@@ -49,6 +51,8 @@ sub commit_changes ($$$) {
        $im->lock_release;
        remove_tree("$old/old") or die "failed to remove $old/old: $!\n";
 }
+
+# we rely on --no-renumber to keep docids synched to NNTP
 my @compact = qw(xapian-compact --no-renumber);
 if ($v == 2) {
        require PublicInbox::V2Writable;