unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/4] www: mail_diff: add final newline before diffing
Date: Tue, 28 Nov 2023 17:37:00 +0000	[thread overview]
Message-ID: <20231128173701.1472101-4-e@80x24.org> (raw)
In-Reply-To: <20231128173701.1472101-1-e@80x24.org>

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

  parent reply	other threads:[~2023-11-28 17:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 17:36 [PATCH 0/4] non-cindex-related stuff Eric Wong
2023-11-28 17:36 ` [PATCH 1/4] lei q: fix --no-import-before completion + docs Eric Wong
2023-11-28 17:36 ` [PATCH 2/4] www: mail_diff: fix optional address obfuscation Eric Wong
2023-11-28 17:37 ` Eric Wong [this message]
2023-11-28 17:37 ` [PATCH 4/4] www: mail_diff: add missing </pre> tag Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231128173701.1472101-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).