@matheusbsbs / matheus-bagliano / commits / 2206537c07
Fork 0

gitweb: Test if $from_id and $to_id are defined before comparison

Get rid of "Use of uninitialized value in string eq at gitweb/gitweb.perl line 2320" warning caused by the fact that "empty" patches, consisting only of extended git diff header and with patch body empty, such as patch for pure rename, does not have "index" line in extended diff header. For such patches $from_id and $to_id, filled from parsing extended diff header, are undefined. But such patches cannot be continuation patches. Test if $from_id and $to_id are defined before comparing them with $diffinfo. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed May 12, 2007 at 12:42 UTC 2206537c07973fc2933092313d95340e076440e4
1 file changed +2 -1
gitweb/gitweb.perl
+2 -1
@@ -2660,9 +2660,10 @@ sub git_patchset_body {
2660 # check if current patch belong to current raw line
2661 # and parse raw git-diff line if needed
2662 if (defined $diffinfo &&
2663 + defined $from_id && defined $to_id &&
2664 from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
2665 $diffinfo->{'to_id'} eq $to_id) {
2665 - # this is split patch
2666 + # this is continuation of a split patch
2667 print "<div class=\"patch cont\">\n";
2668 } else {
2669 # advance raw git-diff output if needed