user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/4] watch_maildir: add scan test
  2016-06-19  0:28  6% [PATCH 0/4] watch improvements for mirroring Eric Wong
@ 2016-06-19  0:28  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2016-06-19  0:28 UTC (permalink / raw)
  To: meta

This should be portable despite the intended use of this
directory being non-portable.
---
 lib/PublicInbox/WatchMaildir.pm |  7 ++++++-
 t/watch_maildir.t               | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 t/watch_maildir.t

diff --git a/lib/PublicInbox/WatchMaildir.pm b/lib/PublicInbox/WatchMaildir.pm
index 3536375..f1a21b9 100644
--- a/lib/PublicInbox/WatchMaildir.pm
+++ b/lib/PublicInbox/WatchMaildir.pm
@@ -45,10 +45,14 @@ sub new {
 	}, $class;
 }
 
+sub _done_for_now {
+	$_->done foreach values %{$_[0]->{importers}};
+}
+
 sub _try_fsn_paths {
 	my ($self, $paths) = @_;
 	_try_path($self, $_->{path}) foreach @$paths;
-	$_->done foreach values %{$self->{importers}};
+	_done_for_now($self);
 }
 
 sub _try_path {
@@ -133,6 +137,7 @@ sub scan {
 		}
 		closedir $dh;
 	}
+	_done_for_now($self);
 }
 
 1;
diff --git a/t/watch_maildir.t b/t/watch_maildir.t
new file mode 100644
index 0000000..6564a86
--- /dev/null
+++ b/t/watch_maildir.t
@@ -0,0 +1,39 @@
+# Copyright (C) 2016 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+use Test::More;
+use File::Temp qw/tempdir/;
+use Email::MIME;
+use PublicInbox::Config;
+
+my $tmpdir = tempdir('watch_maildir-XXXXXX', TMPDIR => 1, CLEANUP => 1);
+my $git_dir = "$tmpdir/test.git";
+my $maildir = "$tmpdir/md";
+use_ok 'PublicInbox::WatchMaildir';
+use_ok 'PublicInbox::Emergency';
+my $cfgpfx = "publicinbox.test";
+my $addr = 'test-public@example.com';
+is(system(qw(git init -q --bare), $git_dir), 0, 'initialized git dir');
+
+my $msg = <<EOF;
+From: user\@example.com
+To: $addr
+Subject: spam
+Message-Id: <a\@b.com>
+Date: Sat, 18 Jun 2016 00:00:00 +0000
+
+msg
+EOF
+PublicInbox::Emergency->new($maildir)->prepare(\$msg);
+
+my $config = PublicInbox::Config->new({
+	"$cfgpfx.address" => $addr,
+	"$cfgpfx.mainrepo" => $git_dir,
+	"$cfgpfx.watch" => "maildir:$maildir",
+});
+
+PublicInbox::WatchMaildir->new($config)->scan;
+my $git = PublicInbox::Git->new($git_dir);
+my @list = $git->qx(qw(rev-list refs/heads/master));
+is(scalar @list, 1, 'one revision in rev-list');
+
+done_testing;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] watch improvements for mirroring
@ 2016-06-19  0:28  6% Eric Wong
  2016-06-19  0:28  7% ` [PATCH 2/4] watch_maildir: add scan test Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2016-06-19  0:28 UTC (permalink / raw)
  To: meta

public-inbox-watch is more liberal than public-inbox-mda,
so we need to make some adjustments about how it handles
messages with missing Message-IDs, Subjects, and such.

Eric Wong (4):
      emergency: avoid needless mkpath dependency
      watch_maildir: add scan test
      watch_maildir: spam removal support
      import: allow messages without subject

 lib/PublicInbox/Emergency.pm    |   4 +-
 lib/PublicInbox/Import.pm       |   7 +-
 lib/PublicInbox/WatchMaildir.pm | 141 ++++++++++++++++++++++++++++++----------
 t/watch_maildir.t               |  83 +++++++++++++++++++++++
 4 files changed, 197 insertions(+), 38 deletions(-)


^ permalink raw reply	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-06-19  0:28  6% [PATCH 0/4] watch improvements for mirroring Eric Wong
2016-06-19  0:28  7% ` [PATCH 2/4] watch_maildir: add scan test Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).