* [PATCH 0/4] non-cindex-related stuff
@ 2023-11-28 17:36 7% Eric Wong
2023-11-28 17:37 6% ` [PATCH 3/4] www: mail_diff: add final newline before diffing Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-11-28 17:36 UTC (permalink / raw)
To: meta
Well, I actually found the mail_diff bugs while looking into
micro-optimizing -cindex.
Eric Wong (4):
lei q: fix --no-import-before completion + docs
www: mail_diff: fix optional address obfuscation
www: mail_diff: add final newline before diffing
www: mail_diff: add missing </pre> tag
Documentation/lei-q.pod | 5 +++--
lib/PublicInbox/LEI.pm | 1 +
lib/PublicInbox/MailDiff.pm | 11 ++++++++---
t/lei-mail-diff.t | 1 +
t/lei-q-kw.t | 19 ++++++++++++++++---
t/psgi_v2.t | 1 +
6 files changed, 30 insertions(+), 8 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 3/4] www: mail_diff: add final newline before diffing
2023-11-28 17:36 7% [PATCH 0/4] non-cindex-related stuff Eric Wong
@ 2023-11-28 17:37 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-11-28 17:37 UTC (permalink / raw)
To: meta
This gets rid of the "\ No newline at end of file"
since it's distracting noise.
---
lib/PublicInbox/MailDiff.pm | 2 +-
t/lei-mail-diff.t | 1 +
t/psgi_v2.t | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/MailDiff.pm b/lib/PublicInbox/MailDiff.pm
index 98284b23..89284e39 100644
--- a/lib/PublicInbox/MailDiff.pm
+++ b/lib/PublicInbox/MailDiff.pm
@@ -24,7 +24,7 @@ sub write_part { # Eml->each_part callback
$s //= $part->body;
$s =~ s/\r\n/\n/gs; # TODO: consider \r+\n to match View
$s =~ s/\s*\z//s;
- write_file '>:utf8', "$self->{curdir}/$idx.$sfx", $s;
+ write_file '>:utf8', "$self->{curdir}/$idx.$sfx", $s, "\n";
}
# public
diff --git a/t/lei-mail-diff.t b/t/lei-mail-diff.t
index 9398596a..1a896e51 100644
--- a/t/lei-mail-diff.t
+++ b/t/lei-mail-diff.t
@@ -7,6 +7,7 @@ test_lei(sub {
ok(!lei('mail-diff', 't/data/0001.patch', 't/data/binary.patch'),
'different messages are different');
like($lei_out, qr/^\+/m, 'diff shown');
+ unlike $lei_out, qr/No newline at end of file/;
lei_ok('mail-diff', 't/data/0001.patch', 't/data/0001.patch');
is($lei_out, '', 'no output if identical');
});
diff --git a/t/psgi_v2.t b/t/psgi_v2.t
index 5ccaab19..54faae9b 100644
--- a/t/psgi_v2.t
+++ b/t/psgi_v2.t
@@ -287,6 +287,7 @@ my $client1 = sub {
'cr_mismatch is only diff context');
like($raw, qr!>\-pipe !s, 'pipe diff del line');
like($raw, qr!>\+pipe !s, 'pipe diff ins line');
+ unlike $raw, qr/No newline at end of file/;
};
test_psgi(sub { $www->call(@_) }, $client1);
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-11-28 17:36 7% [PATCH 0/4] non-cindex-related stuff Eric Wong
2023-11-28 17:37 6% ` [PATCH 3/4] www: mail_diff: add final newline before diffing 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).