about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepobrowseGitDiffCommon.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-01-11 04:12:29 +0000
committerEric Wong <e@80x24.org>2017-01-11 04:13:21 +0000
commit0eaf06c1c2acc65ebc7e45d0d4913958264c3dd1 (patch)
treedbb44dac703622313c84a47b89344bd0b0cdaa2a /lib/PublicInbox/RepobrowseGitDiffCommon.pm
parentfe0f622aefb4f4316d9f6814f4badcda5528eedf (diff)
downloadpublic-inbox-0eaf06c1c2acc65ebc7e45d0d4913958264c3dd1.tar.gz
This is a potentially expensive operation, so we may want to
give it it's own limiter channel.
Diffstat (limited to 'lib/PublicInbox/RepobrowseGitDiffCommon.pm')
-rw-r--r--lib/PublicInbox/RepobrowseGitDiffCommon.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/PublicInbox/RepobrowseGitDiffCommon.pm b/lib/PublicInbox/RepobrowseGitDiffCommon.pm
index ae0e6821..bca50e15 100644
--- a/lib/PublicInbox/RepobrowseGitDiffCommon.pm
+++ b/lib/PublicInbox/RepobrowseGitDiffCommon.pm
@@ -216,6 +216,9 @@ sub git_diff_sed_stat ($$) {
         my $ndel = \($req->{ndel});
         if (!$req->{dstat_started}) {
                 $req->{dstat_started} = 1;
+
+                # merges start with an extra '\0' before the diffstat
+                # non-merge commits start with an extra '\n', instead
                 if ($req->{mhelp}) {
                         if ($stat[0] eq '') {
                                 shift @stat;
@@ -224,8 +227,8 @@ sub git_diff_sed_stat ($$) {
 'initial merge diffstat line was not empty';
                         }
                 } else {
-                        $stat[0] =~ s/\A\n//s or warn
-'failed to remove initial newline from diffstat';
+                        # for commits, only (not diff-tree)
+                        $stat[0] =~ s/\A\n//s;
                 }
         }
         while (defined(my $l = shift @stat)) {