about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepobrowseGitDiffCommon.pm
diff options
context:
space:
mode:
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)) {