about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-08-12 22:08:50 +0000
committerEric Wong <e@80x24.org>2016-08-12 22:08:50 +0000
commit4e6710183bc331020a406077a1873f2713973f07 (patch)
tree0b1a05c26fbb15ad2c1cf5634f6c2e5faac9c58e
parent50c1b933afec4937ebc99e1d372cef2dc6b295c2 (diff)
downloadpublic-inbox-4e6710183bc331020a406077a1873f2713973f07.tar.gz
We need to pass the Inbox object to SearchIdx to get altid
mappings properly for incremental imports.

TODO: use the Inbox object in more places where it makes sense
to do so.
-rw-r--r--lib/PublicInbox/Import.pm6
-rw-r--r--lib/PublicInbox/WatchMaildir.pm2
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index ff5b3f38..9555d27c 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -12,12 +12,13 @@ use PublicInbox::Spawn qw(spawn);
 use PublicInbox::MID qw(mid_mime mid2path);
 
 sub new {
-        my ($class, $git, $name, $email) = @_;
+        my ($class, $git, $name, $email, $inbox) = @_;
         bless {
                 git => $git,
                 ident => "$name <$email>",
                 mark => 1,
                 ref => 'refs/heads/master',
+                inbox => $inbox,
         }, $class
 }
 
@@ -237,7 +238,8 @@ sub done {
 
                 eval {
                         require PublicInbox::SearchIdx;
-                        my $s = PublicInbox::SearchIdx->new($git_dir);
+                        my $inbox = $self->{inbox} || $git_dir;
+                        my $s = PublicInbox::SearchIdx->new($inbox);
                         $s->index_sync({ ref => $self->{ref} });
                 };
         }
diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 145b3636..f34419a3 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -214,7 +214,7 @@ sub _importer_for {
                 my $git = $inbox->git;
                 my $name = $inbox->{name};
                 my $addr = $inbox->{-primary_address};
-                PublicInbox::Import->new($git, $name, $addr);
+                PublicInbox::Import->new($git, $name, $addr, $inbox);
         };
         $self->{importers}->{"$im"} = $im;
 }