From fd541d0488980f649fe615d3c2fc10578a33e339 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Sep 2022 08:17:20 +0000 Subject: viewdiff: diff_before_or_after: avoid extra capture /(.*?)\z/ will capture the "$X insertions(+), $Y deletions(-)" bit anyways, along with whatever extra notes before the /^diff --git / line. So just rely on /(.*?)\z/ and avoid the special case before it. --- lib/PublicInbox/ViewDiff.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/ViewDiff.pm') diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index 5d23881b..b9115669 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -162,9 +162,9 @@ sub diff_before_or_after ($$) { if (exists $ctx->{-anchors} && $$x =~ /\A(.*?) # likely "---\n" # \$1 # diffstat lines: ((?:^\x20(?:[^\n]+?)(?:\x20+\|\x20[^\n]*\n))+) - (\x20[0-9]+\x20files?\x20)changed,([^\n]+\n) + (\x20[0-9]+\x20files?\x20)changed, (.*?)\z/msx) { # notes, commit message, etc - my @x = ($5, $4, $3, $2, $1); + my @x = ($4, $3, $2, $1); undef $$x; my $lnk = $ctx->{-linkify}; my $zfh = $ctx->{zfh}; @@ -177,8 +177,8 @@ sub diff_before_or_after ($$) { my $ch = $ctx->{changed_href} // '#related'; print $zfh pop(@x), # $3 /^ \d+ files? / qq(changed,), - ascii_html(pop @x), # insertions/deletions - $lnk->to_html(@x); # notes, commit message, etc + # insertions/deletions, notes, commit message, etc: + $lnk->to_html(@x); } else { print { $ctx->{zfh} } $ctx->{-linkify}->to_html($$x); } -- cgit v1.2.3-24-ge0c7