From 19655cb200b8d0ecbd217d4c468bbba8d40ce014 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 22 Nov 2023 01:04:18 +0000 Subject: watch: support `watch=false' to negate watchspam For users hosting read-only mirrors (via clone|fetch) and feeding inboxes via -watch --- t/watch_maildir.t | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/watch_maildir.t b/t/watch_maildir.t index 69a5e1f3..07ebeef6 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -16,7 +16,6 @@ use_ok 'PublicInbox::Emergency'; my $addr = 'test-public@example.com'; my $default_branch = PublicInbox::Import::default_branch; PublicInbox::Import::init_bare($git_dir); - my $msg = <add(PublicInbox::Eml->new($msg)) }; + PublicInbox::Emergency->new($maildir)->prepare(\$msg); ok(POSIX::mkfifo("$maildir/cur/fifo", 0777), 'create FIFO to ensure we do not get stuck on it :P'); @@ -56,6 +58,10 @@ my $cfg = cfg_new $tmpdir, <{inboxdir} + address = ro-test\@example.com EOF my $cfg_path = $cfg->{-f}; PublicInbox::Watch->new($cfg)->scan('full'); @@ -82,6 +88,10 @@ is(scalar @list, 2, 'two revisions in rev-list'); is(scalar @list, 0, 'tree is empty'); is(unlink(glob("$spamdir/cur/*")), 1, 'unlinked trained spam'); +@list = $ibx_ro->git->qx(qw(ls-tree -r --name-only), $default_branch); +undef $ibx_ro; +is scalar(@list), 1, 'read-only inbox is unchanged'; + # check with scrubbing { $msg .= qq(-- -- cgit v1.2.3-24-ge0c7