unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] watch: respect altid for incremental watch changes
@ 2016-08-14  5:47 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-08-14  5:47 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-14  5:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-14  5:47 [PATCH] watch: respect altid for incremental watch changes Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).