]> Sergey Matveev's repositories - public-inbox.git/commitdiff
viewdiff: do not link to 0{7,40} blobs (again)
authorEric Wong <e@80x24.org>
Sun, 20 Jan 2019 12:16:47 +0000 (12:16 +0000)
committerEric Wong <e@80x24.org>
Sun, 20 Jan 2019 20:22:34 +0000 (20:22 +0000)
We must reset diff context when starting a new file;
and we must check for all-zeroes object_ids as the
post-image correctly.

lib/PublicInbox/ViewDiff.pm

index 45d28e37792146cbdfd2d4e3c3e93e92241a251c..a8045687ef48b59c0755f4e7b8f750aa722a07d3 100644 (file)
@@ -107,9 +107,11 @@ sub flush_diff ($$$$) {
                        $$dst .= to_html($linkify, $s);
                } elsif ($s =~ s/^(index $OID_NULL\.\.)($OID_BLOB)\b//o) {
                        $$dst .= $1 . oid($dctx, $spfx, $2);
                        $$dst .= to_html($linkify, $s);
                } elsif ($s =~ s/^(index $OID_NULL\.\.)($OID_BLOB)\b//o) {
                        $$dst .= $1 . oid($dctx, $spfx, $2);
+                       $dctx = { Q => '' };
                        $$dst .= to_html($linkify, $s) ;
                        $$dst .= to_html($linkify, $s) ;
-               } elsif ($s =~ s/^index ($OID_NULL)(\.\.$OID_BLOB)\b//o) {
+               } elsif ($s =~ s/^index ($OID_BLOB)(\.\.$OID_NULL)\b//o) {
                        $$dst .= 'index ' . oid($dctx, $spfx, $1) . $2;
                        $$dst .= 'index ' . oid($dctx, $spfx, $1) . $2;
+                       $dctx = { Q => '' };
                        $$dst .= to_html($linkify, $s);
                } elsif ($s =~ /^index ($OID_BLOB)\.\.($OID_BLOB)/o) {
                        $dctx->{oid_a} = $1;
                        $$dst .= to_html($linkify, $s);
                } elsif ($s =~ /^index ($OID_BLOB)\.\.($OID_BLOB)/o) {
                        $dctx->{oid_a} = $1;