]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiExternal.pm
lei: All Local Externals: bare git dir for alternates
[public-inbox.git] / lib / PublicInbox / LeiExternal.pm
index 47791d4e21ba0d2d67e48f99aadfbcce13752ce5..aa09be9ea980035d4a2024497c69d025c7bf523e 100644 (file)
@@ -139,6 +139,12 @@ sub add_external_finish {
        my $key = "external.$location.boost";
        my $cur_boost = $cfg->{$key};
        return if defined($cur_boost) && $cur_boost == $new_boost; # idempotent
+       if (-d $location) {
+               require PublicInbox::LeiXSearch;
+               my $lxs = PublicInbox::LeiXSearch->new;
+               $lxs->prepare_external($location);
+               $self->ale->refresh_externals($lxs);
+       }
        $self->lei_config($key, $new_boost);
 }
 
@@ -170,9 +176,14 @@ sub lei_add_external {
                $self->fail(<<""); # TODO: did you mean "update-external?"
 --mirror destination `$location' already exists
 
+       } elsif (-d $location) {
+               index($location, "\n") >= 0 and
+                       return $self->fail("`\\n' not allowed in `$location'");
        }
        if ($location !~ m!\Ahttps?://! && !-d $location) {
                $mirror // return $self->fail("$location not a directory");
+               index($location, "\n") >= 0 and
+                       return $self->fail("`\\n' not allowed in `$location'");
                $mirror = ext_canonicalize($mirror);
                require PublicInbox::LeiMirror;
                PublicInbox::LeiMirror->start($self, $mirror => $location);