Skip to content

Commit 98885c2

Browse files
avargitster
authored andcommitted
gitweb/gitweb.perl: don't call S_ISREG() with undef
Change S_ISREG($to_mode_oct) to S_ISREG($from_mode_oct) in the branch that handles from modes, not to modes. This logic appears to have been caused by copy/paste programming by Jakub Narebski in e8e41a9. It would be better to rewrite this code not to be duplicated, but I haven't done so. This issue caused a failing test on perl 5.13.9, which has a warning that turned this up: gitweb.perl: Use of uninitialized value in subroutine entry at /home/avar/g/git/t/../gitweb/gitweb.perl line 4415. Which caused the Git test suite to fail on this test: ./t9500-gitweb-standalone-no-errors.sh (Wstat: 256 Tests: 90 Failed: 84) Failed tests: 1-8, 10-36, 38-45, 47-48, 50-88 Non-zero exit status: 1 Reported-by: perl 5.13.9 Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Acked-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f54b7d commit 98885c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4412,7 +4412,7 @@ sub git_difftree_body {
44124412
}
44134413
if ($diff->{'from_mode'} ne ('0' x 6)) {
44144414
$from_mode_oct = oct $diff->{'from_mode'};
4415-
if (S_ISREG($to_mode_oct)) { # only for regular file
4415+
if (S_ISREG($from_mode_oct)) { # only for regular file
44164416
$from_mode_str = sprintf("%04o", $from_mode_oct & 0777); # permission bits
44174417
}
44184418
$from_file_type = file_type($diff->{'from_mode'});

0 commit comments

Comments
 (0)