X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FViewDiff.pm;fp=lib%2FPublicInbox%2FViewDiff.pm;h=960f7e6128d149faaec18e374c17e06f2b2a41db;hb=66512e177390aedb4a9380484230768621528e57;hp=fb394b7c430e5b47994f1af91e8c644b673030ef;hpb=6b4e4f0d2d52a4b39c68d8f63915ddb7e1e8270e;p=public-inbox.git
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index fb394b7c..960f7e61 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2021 all contributors
+# Copyright (C) all contributors
# License: AGPL-3.0+
#
# used by PublicInbox::View
@@ -141,13 +141,16 @@ sub diff_header ($$$) {
# no need to capture oid_a and oid_b on add/delete,
# we just linkify OIDs directly via s///e in conditional
- if (($$x =~ s/$NULL_TO_BLOB/$1 . oid($dctx, $spfx, $2)/e) ||
- ($$x =~ s/$BLOB_TO_NULL/
- 'index ' . oid($dctx, $spfx, $1) . $2/e)) {
+ if ($$x =~ s/$NULL_TO_BLOB/$1 . oid($dctx, $spfx, $2)/e) {
+ push @{$ctx->{-qry}->{dfpost}}, $2;
+ } elsif ($$x =~ s/$BLOB_TO_NULL/'index '.oid($dctx, $spfx, $1).$2/e) {
+ push @{$ctx->{-qry}->{dfpre}}, $1;
} elsif ($$x =~ $BLOB_TO_BLOB) {
# modification-only, not add/delete:
# linkify hunk headers later using oid_a and oid_b
@$dctx{qw(oid_a oid_b)} = ($1, $2);
+ push @{$ctx->{-qry}->{dfpre}}, $1;
+ push @{$ctx->{-qry}->{dfpost}}, $2;
} else {
warn "BUG? <$$x> had no ^index line";
}
@@ -172,9 +175,16 @@ sub diff_before_or_after ($$) {
# ok, looks like a diffstat, go line-by-line:
for my $l (split(/^/m, $y)) {
if ($l =~ /^ (.+)( +\| .*\z)/s) {
- anchor0($dst, $ctx, $1, $2) and next;
+ anchor0($dst, $ctx, $1, $2) or
+ $$dst .= $linkify->to_html($l);
+ } elsif ($l =~ s/^( [0-9]+ files? )changed,//) {
+ $$dst .= $1;
+ my $end = $ctx->{end_id} // 'related';
+ $$dst .= "changed,";
+ $$dst .= ascii_html($l);
+ } else {
+ $$dst .= $linkify->to_html($l);
}
- $$dst .= $linkify->to_html($l);
}
} else { # commit message, notes, etc
$$dst .= $linkify->to_html($y);