From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B761720193 for ; Sun, 14 Aug 2016 05:47:36 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] watch: respect altid for incremental watch changes Date: Sun, 14 Aug 2016 05:47:36 +0000 Message-Id: <20160814054736.26632-1-e@80x24.org> List-Id: 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 | 6 ++++-- lib/PublicInbox/WatchMaildir.pm | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index ff5b3f3..9555d27 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 145b363..f34419a 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; } -- EW