about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-30 01:20:41 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-30 01:21:00 +0000
commit33244ea82ffd35f40ac82d81a857005587842454 (patch)
treec3ab05f2aea93ce01580f0d86145e80b74b2573c /lib
parent62fc4208337b5ea07240bfaa3a8ee5d670b75f72 (diff)
downloadpublic-inbox-33244ea82ffd35f40ac82d81a857005587842454.tar.gz
Somebody may only care about the most recent history,
so allow -init and -index to operate quietly on missing
partitions.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/V2Writable.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 4e7d6de1..6394d300 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -67,7 +67,9 @@ sub init_inbox {
         my ($self, $parallel) = @_;
         $self->{parallel} = $parallel;
         $self->idx_init;
-        $self->git_init(0);
+        my $max_git = -1;
+        git_dir_latest($self, \$max_git);
+        $self->git_init($max_git >= 0 ? $max_git : 0);
         $self->done;
 }
 
@@ -621,6 +623,7 @@ sub reindex {
                 for (my $cur = $max_git; $cur >= 0; $cur--) {
                         die "already reindexing!\n" if $self->{reindex_pipe};
                         my $git = PublicInbox::Git->new("$pfx/$cur.git");
+                        -d $git->{git_dir} or next; # missing parts are fine
                         chomp($tip = $git->qx('rev-parse', $head)) unless $tip;
                         my $h = $cur == $max_git ? $tip : $head;
                         my @count = ('rev-list', '--count', $h, '--', 'm');
@@ -642,6 +645,7 @@ sub reindex {
                 die "already reindexing!\n" if delete $self->{reindex_pipe};
                 my $cmt;
                 my $git_dir = "$pfx/$cur.git";
+                -d $git_dir or next; # missing parts are fine
                 my $git = PublicInbox::Git->new($git_dir);
                 my $h = $cur == $max_git ? $tip : $head;
                 my $fh = $self->{reindex_pipe} = $git->popen(@cmd, $h);