]> Sergey Matveev's repositories - public-inbox.git/commitdiff
v2writable: purge ignores non-existent git epoch directories
authorEric Wong <e@80x24.org>
Fri, 11 Jan 2019 01:02:45 +0000 (01:02 +0000)
committerEric Wong <e@80x24.org>
Fri, 11 Jan 2019 03:57:42 +0000 (03:57 +0000)
We don't require every git epoch to exist since we support
the --skip feature in public-inbox-init.

lib/PublicInbox/V2Writable.pm

index 08d18fc099a25f340432f0ad01ce22ad6f40666e..970244eb433944cb4ebecb064146002fc427667c 100644 (file)
@@ -286,7 +286,9 @@ sub purge_oids {
        my $pfx = "$self->{-inbox}->{mainrepo}/git";
        my $purges = [];
        foreach my $i (0..$self->{epoch_max}) {
-               my $git = PublicInbox::Git->new("$pfx/$i.git");
+               my $git_dir = "$pfx/$i.git";
+               -d $git_dir or next;
+               my $git = PublicInbox::Git->new($git_dir);
                my $im = $self->import_init($git, 0, 1);
                $purges->[$i] = $im->purge_oids($purge);
        }