Skip to content

Commit

Permalink
gitweb: Fix errors in git_patchset_body for empty patches
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Jan 7, 2007
1 parent 2e1951f commit 66399ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2403,7 +2403,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;
Expand Down Expand Up @@ -2522,6 +2522,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/' .
Expand Down

0 comments on commit 66399ef

Please sign in to comment.