From: Eric Wong Date: Tue, 28 Nov 2023 17:37:00 +0000 (+0000) Subject: www: mail_diff: add final newline before diffing X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a9587de359122b462bee32871e86bef19916ecf;p=thirdparty%2Fpublic-inbox.git www: mail_diff: add final newline before diffing This gets rid of the "\ No newline at end of file" since it's distracting noise. --- diff --git a/lib/PublicInbox/MailDiff.pm b/lib/PublicInbox/MailDiff.pm index 98284b23a..89284e39c 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 9398596ab..1a896e515 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 5ccaab199..54faae9b4 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);