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 1/2] learn: fix buggy typo on List-ID mapping
  2020-05-26  9:05  6% [PATCH 0/2] -learn fixes and updates Eric Wong
@ 2020-05-26  9:05  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-05-26  9:05 UTC (permalink / raw)
  To: meta

There is obviously a typo here, so fix it and add a test
case to guard against future regressions.

Fixes: 74a3206babe0572a ("mda: support multiple List-ID matches")
---
 script/public-inbox-learn |  2 +-
 t/mda.t                   | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/script/public-inbox-learn b/script/public-inbox-learn
index a33d813ad01..0cb2c8e96e5 100644
--- a/script/public-inbox-learn
+++ b/script/public-inbox-learn
@@ -97,7 +97,7 @@ if ($train eq 'spam') {
 	}
 	my $dests = PublicInbox::MDA->inboxes_for_list_id($pi_config, $mime);
 	for my $ibx (@$dests) {
-		next if !$seen{"$ibx"}++;
+		next if $seen{"$ibx"}++;
 		remove_or_add($ibx, $train, $mime, $ibx->{-primary_address});
 	}
 }
diff --git a/t/mda.t b/t/mda.t
index 759c0b020ab..c7caf3e0cca 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -299,9 +299,17 @@ EOF
 	ok(run_script(['-mda'], undef, $rdr),
 		'mda OK with multiple List-Id matches');
 	$cur = $git->qx(qw(diff HEAD~1..HEAD));
-	like($cur, qr/Message-ID: <2lids\@example>/,
+	like($cur, qr/^\+Message-ID: <2lids\@example>/sm,
 		'multi List-ID match delivered');
 	like($err, qr/multiple List-ID/, 'warned about multiple List-ID');
+
+	# ensure -learn rm works after inbox address is updated
+	($out, $err) = ('', '');
+	xsys(qw(git config --file), $pi_config, "$cfgpfx.address",
+		'updated-address@example.com');
+	ok(run_script(['-learn', 'rm'], undef, $rdr), 'rm-ed via -learn');
+	$cur = $git->qx(qw(diff HEAD~1..HEAD));
+	like($cur, qr/^-Message-ID: <2lids\@example>/sm, 'changed in git');
 }
 
 done_testing();

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/2] -learn fixes and updates
@ 2020-05-26  9:05  6% Eric Wong
  2020-05-26  9:05  7% ` [PATCH 1/2] learn: fix buggy typo on List-ID mapping Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-05-26  9:05 UTC (permalink / raw)
  To: meta

I noticed -learn was lacking in some areas while working on
other stuff.  Maybe more consistency improvements with other
CLI tools coming...

Eric Wong (2):
  learn: fix buggy typo on List-ID mapping
  learn: support --all with `rm'

 Documentation/public-inbox-learn.pod |  8 ++++++--
 script/public-inbox-learn            | 11 ++++++++---
 t/mda.t                              | 10 +++++++++-
 3 files changed, 23 insertions(+), 6 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 --
2020-05-26  9:05  6% [PATCH 0/2] -learn fixes and updates Eric Wong
2020-05-26  9:05  7% ` [PATCH 1/2] learn: fix buggy typo on List-ID mapping 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).