]> Sergey Matveev's repositories - public-inbox.git/commitdiff
watch: respect altid for incremental watch changes
authorEric Wong <e@80x24.org>
Fri, 12 Aug 2016 22:08:50 +0000 (22:08 +0000)
committerEric Wong <e@80x24.org>
Fri, 12 Aug 2016 22:08:50 +0000 (22:08 +0000)
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.

lib/PublicInbox/Import.pm
lib/PublicInbox/WatchMaildir.pm

index ff5b3f38460fedf8bf0853517ca22923dcf09f05..9555d27c44ef6d3588a2b1761954bddd800375b8 100644 (file)
@@ -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} });
                };
        }
index 145b363689ee7aa42c292f99c15798a404b7ff24..f34419a399005b6bbbfb7bbb27cb9a22442519fe 100644 (file)
@@ -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;
 }