about summary refs log tree commit homepage
path: root/lib/PublicInbox/CodeSearchIdx.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/CodeSearchIdx.pm')
-rw-r--r--lib/PublicInbox/CodeSearchIdx.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 587f0b81..97c563bd 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -27,7 +27,7 @@ use File::Spec ();
 use PublicInbox::SHA qw(sha256_hex);
 use PublicInbox::Search qw(xap_terms);
 use PublicInbox::SearchIdx qw(add_val);
-use PublicInbox::Config;
+use PublicInbox::Config qw(glob2re);
 use PublicInbox::Spawn qw(spawn popen_rd);
 use PublicInbox::OnDestroy;
 use Socket qw(MSG_EOR);
@@ -566,6 +566,14 @@ sub cidx_run { # main entry point
                 }
                 warn "E: canonicalized and attempting to continue\n";
         }
+        if (defined(my $excl = $self->{-opt}->{exclude})) {
+                my $re = '(?:'.join('\\z|', map {
+                                glob2re($_) // qr/\A\Q$_\E/
+                        } @$excl).'\\z)';
+                @{$self->{git_dirs}} = grep {
+                        $_ =~ /$re/ ? (warn("# excluding $_\n"), 0) : 1;
+                } @{$self->{git_dirs}};
+        }
         local $self->{nchange} = 0;
         local $LIVE_JOBS = $self->{-opt}->{jobs} ||
                         PublicInbox::IPC::detect_nproc() || 2;