about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-16 06:54:08 +0000
committerEric Wong <e@80x24.org>2019-05-16 06:54:08 +0000
commitfee27210002cc343e4e99e3a8b10ac9fa5f0f26a (patch)
tree63a4566955ec31532aeb881028cfa54df8ae06e6
parentc23df198cb3b101c8f0ede73092c8f3dae5eda35 (diff)
downloadpublic-inbox-fee27210002cc343e4e99e3a8b10ac9fa5f0f26a.tar.gz
This was buggy and was causing non-diff text to have extra
leading spaces.  The diff parsing code needs to be cleaned up,
so this will be fixed, later.

This reverts commit 1a67b91c1326efa372d1ec957e2494849d894f0b.
-rw-r--r--lib/PublicInbox/View.pm4
-rw-r--r--lib/PublicInbox/ViewDiff.pm6
2 files changed, 1 insertions, 9 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 35e171b0..47a2046e 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -568,9 +568,7 @@ sub add_text_body {
         # always support diff-highlighting, but we can't linkify hunk
         # headers for solver unless some coderepo are configured:
         my $diff;
-        if ($s =~ /^([ \t]*)(?:diff|---|\+{3}) /ms) {
-                $ctx->{-dpfx} = $1 if $1; # for format-patch --interdiff output
-
+        if ($s =~ /^(?:diff|---|\+{3}) /ms) {
                 # diffstat anchors do not link across attachments or messages:
                 $idx[0] = $upfx . $idx[0] if $upfx ne '';
                 $ctx->{-apfx} = join('/', @idx);
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index e9cfc368..6b8d9437 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -141,14 +141,8 @@ sub flush_diff ($$$) {
         my $spfx = $ctx->{-spfx};
         my $state = DSTATE_INIT;
         my $dctx = { Q => '' }; # {}, keys: oid_a, oid_b, path_a, path_b
-        my $dpfx = $ctx->{-dpfx}; # leading spaces for interdiff
-        my $dpfx_re = qr/\A$dpfx/ if defined $dpfx;
 
         foreach my $s (@$diff) {
-                if (defined($dpfx)) {
-                        $s =~ s/$dpfx_re//;
-                        $$dst .= $dpfx;
-                }
                 if ($s =~ /^---$/) {
                         to_state($dst, $state, DSTATE_STAT);
                         $$dst .= $s;