about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-03-19 20:38:49 -0200
committerEric Wong <e@80x24.org>2021-03-19 20:50:45 -0400
commitaf25645f39a68b02f72d9acd4ed09deb2e995dec (patch)
treeb49e74b242bbf940fb3e4ea361fd9e86288cc85b /lib/PublicInbox/LeiQuery.pm
parent1d1498c6c5d42733bd63bd109076882c5d6e8a2a (diff)
downloadpublic-inbox-af25645f39a68b02f72d9acd4ed09deb2e995dec.tar.gz
Assume that anybody using -I/--include for external locations
will want to override --no-$FOO if they're explicitly including
a location.

With some effort, we could make it order-dependent (e.g.
"-I $LOCATION --no-$FOO" and "--no-$FOO -I $LOCATION"
behave differently).  However that's not straightforward
when using Getopt::Long to parse command-line options into
a hashref.

I'm also not sure if order-dependent switches are a desirable
UI/UX quality.
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 623b92cd..532668ae 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -64,9 +64,12 @@ sub lei_q {
                         $lxs->prepare_external($_) for @loc;
                 }
         } else {
+                my (@ilocals, @iremotes);
                 for my $loc (@{$opt->{include} // []}) {
                         my @loc = $self->get_externals($loc) or return;
                         $lxs->prepare_external($_) for @loc;
+                        @ilocals = @{$lxs->{locals} // []};
+                        @iremotes = @{$lxs->{remotes} // []};
                 }
                 # --external is enabled by default, but allow --no-external
                 if ($opt->{external} //= 1) {
@@ -78,9 +81,9 @@ sub lei_q {
                         my $ne = $self->externals_each(\&prep_ext, $lxs, \%x);
                         $opt->{remote} //= !($lxs->locals - $opt->{'local'});
                         if ($opt->{'local'}) {
-                                delete($lxs->{remotes}) if !$opt->{remote};
+                                $lxs->{remotes} = \@iremotes if !$opt->{remote};
                         } else {
-                                delete($lxs->{locals});
+                                $lxs->{locals} = \@ilocals;
                         }
                 }
         }