about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-12-01 11:21:31 +0000
committerEric Wong <e@80x24.org>2022-12-02 08:07:40 +0000
commit3f7bd6ba4d30f16ef95af9121ad8fe7b47a4f5f7 (patch)
treef2005b749a203fbc5da61bd2ed99b77d6de76518
parenteb22c4833d455b655b42b492dfad7f2abfc83203 (diff)
downloadpublic-inbox-3f7bd6ba4d30f16ef95af9121ad8fe7b47a4f5f7.tar.gz
I ended up with my $HOME in
~/.cache/lei/all_locals_ever.git/objects/info/alterntes
and am trying to avoid that in the future.
-rw-r--r--lib/PublicInbox/LeiXSearch.pm5
-rw-r--r--t/lei.t3
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 90cb83b9..8e195c4c 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -617,11 +617,12 @@ sub prepare_external {
         } elsif ($loc =~ m!\Ahttps?://!) {
                 require URI;
                 return add_uri($self, URI->new($loc));
-        } elsif (-f "$loc/ei.lock") {
+        } elsif (-f "$loc/ei.lock" && -d "$loc/ALL.git/objects") {
                 require PublicInbox::ExtSearch;
                 die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0;
                 $loc = PublicInbox::ExtSearch->new($loc);
-        } elsif (-f "$loc/inbox.lock" || -d "$loc/public-inbox") {
+        } elsif ((-f "$loc/inbox.lock" && -d "$loc/all.git/objects") ||
+                        (-d "$loc/public-inbox" && -d "$loc/objects")) {
                 die "`\\n' not allowed in `$loc'\n" if index($loc, "\n") >= 0;
                 require PublicInbox::Inbox; # v2, v1
                 $loc = bless { inboxdir => $loc }, 'PublicInbox::Inbox';
diff --git a/t/lei.t b/t/lei.t
index b10c9b59..a80143ef 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -148,7 +148,8 @@ my $test_fail = sub {
 
         for my $lk (qw(ei inbox)) {
                 my $d = "$home/newline\n$lk";
-                mkdir $d;
+                my $all = $lk eq 'ei' ? 'ALL' : 'all';
+                File::Path::mkpath("$d/$all.git/objects");
                 open my $fh, '>', "$d/$lk.lock" or BAIL_OUT "open $d/$lk.lock";
                 for my $fl (qw(-I --only)) {
                         ok(!lei('q', $fl, $d, 'whatever'),