]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Fix errors in git_patchset_body for empty patches
authorJakub Narebski <redacted>
Sun, 7 Jan 2007 01:52:25 +0000 (02:52 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
We now do not skip over empty patches in git_patchset_body (where
empty means that they consist only of git diff header, and of extended
diff header, for example "pure rename" patch).  This means that after
extended diff header there can be next patch (i.e. /^diff /) or end of
patchset, and not necessary patch body (i.e. /^--- /).

Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 9d135b77536bc6496c61909ad5143d2f888d7b6a27659caa6f4f70f2b798ab8e..f7b53153ee81003196a325c6145a8a647ebce39d9ce8afd6c650271fc888fd61 100755 (executable)
@@ -2404,7 +2404,7 @@ sub git_patchset_body {
                while ($patch_line = <$fd>) {
                        chomp $patch_line;
 
-                       last EXTENDED_HEADER if ($patch_line =~ m/^--- /);
+                       last EXTENDED_HEADER if ($patch_line =~ m/^--- |^diff /);
 
                        if ($patch_line =~ m/^index ([0-9a-fA-F]{40})..([0-9a-fA-F]{40})/) {
                                $from_id = $1;
@@ -2523,6 +2523,8 @@ sub git_patchset_body {
 
                # from-file/to-file diff header
                $patch_line = $last_patch_line;
+               last PATCH unless $patch_line;
+               next PATCH if ($patch_line =~ m/^diff /);
                #assert($patch_line =~ m/^---/) if DEBUG;
                if ($from{'href'}) {
                        $patch_line = '--- a/' .
This page took 0.286826 seconds and 4 git commands to generate.