]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Test if $from_id and $to_id are defined before comparison
authorJakub Narebski <redacted>
Sat, 12 May 2007 10:42:32 +0000 (12:42 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 2298acf2421170eea8694f6159fb80efafd7629ca0b6b678c46744f14d88803d..e4c20cca00ae4ff6d9a190ef0b0c348ca8c5ae35bff4f2f795d7505182169415 100755 (executable)
@@ -2661,9 +2661,10 @@ sub git_patchset_body {
                # check if current patch belong to current raw line
                # and parse raw git-diff line if needed
                if (defined $diffinfo &&
                # check if current patch belong to current raw line
                # and parse raw git-diff line if needed
                if (defined $diffinfo &&
+                   defined $from_id && defined $to_id &&
                    from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
                    $diffinfo->{'to_id'} eq $to_id) {
                    from_ids_eq($diffinfo->{'from_id'}, $from_id) &&
                    $diffinfo->{'to_id'} eq $to_id) {
-                       # this is split patch
+                       # this is continuation of a split patch
                        print "<div class=\"patch cont\">\n";
                } else {
                        # advance raw git-diff output if needed
                        print "<div class=\"patch cont\">\n";
                } else {
                        # advance raw git-diff output if needed
This page took 0.428533 seconds and 4 git commands to generate.