]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei_mirror: move directory creation to v2-only path
authorEric Wong <e@80x24.org>
Mon, 28 Nov 2022 05:31:06 +0000 (05:31 +0000)
committerEric Wong <e@80x24.org>
Mon, 28 Nov 2022 23:38:53 +0000 (23:38 +0000)
We rely on `git clone' to create the destination directory
for v1 and coderepos, so having it in _try_config_start was
senseless.

lib/PublicInbox/LeiMirror.pm

index 285c64d8841079abd7b21a5673255bb772842455..6d72f15d52c72a0e9786e2bb3bd1da35a37b7a12 100644 (file)
@@ -137,12 +137,6 @@ sub _get_txt_done {
 # tries the relatively new /$INBOX/_/text/config/raw endpoint
 sub _try_config_start {
        my ($self) = @_;
-       my $dst = $self->{cur_dst} // $self->{dst};
-       if (!-d $dst || !mkdir($dst)) {
-               require File::Path;
-               File::Path::mkpath($dst);
-               -d $dst or die "mkpath($dst): $!\n";
-       }
        _get_txt_start($self, qw(_/text/config/raw inbox.config.example), 0444);
 }
 
@@ -381,6 +375,12 @@ failed to extract epoch number from $src
        }
        # filter out the epochs we skipped
        $self->{-culled_manifest} = 1 if delete(@$m{@skip});
+
+       if (!-d $dst || !mkdir($dst)) {
+               require File::Path;
+               File::Path::mkpath($dst);
+               -d $dst or die "mkpath($dst): $!\n";
+       }
        my $lk = bless { lock_path => "$dst/inbox.lock" }, 'PublicInbox::Lock';
        my $fini = PublicInbox::OnDestroy->new($$, \&v2_done, $task);
        $LIVE{_try_config_start($task)} = [ \&_try_config_done, $task, $fini ];