Skip to content

Commit 66399ef

Browse files
jnarebJunio C Hamano
authored andcommitted
gitweb: Fix errors in git_patchset_body for empty patches
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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 2e1951f commit 66399ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitweb/gitweb.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ sub git_patchset_body {
24032403
while ($patch_line = <$fd>) {
24042404
chomp $patch_line;
24052405

2406-
last EXTENDED_HEADER if ($patch_line =~ m/^--- /);
2406+
last EXTENDED_HEADER if ($patch_line =~ m/^--- |^diff /);
24072407

24082408
if ($patch_line =~ m/^index ([0-9a-fA-F]{40})..([0-9a-fA-F]{40})/) {
24092409
$from_id = $1;
@@ -2522,6 +2522,8 @@ sub git_patchset_body {
25222522

25232523
# from-file/to-file diff header
25242524
$patch_line = $last_patch_line;
2525+
last PATCH unless $patch_line;
2526+
next PATCH if ($patch_line =~ m/^diff /);
25252527
#assert($patch_line =~ m/^---/) if DEBUG;
25262528
if ($from{'href'}) {
25272529
$patch_line = '--- a/' .

0 commit comments

Comments
 (0)