]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.cgi
gitweb: avoid undefined value warning in print_page_path
[Gitweb] / gitweb.cgi
index 94dd1acdb853ceba1a3958f5cff98be8b793689b57892546d52fd9e951b1b49b..95262271d24801ccd946981f487e45dca6003c44794babe485bda08349d3676b 100755 (executable)
@@ -779,9 +779,11 @@ sub mimetype_guess_file {
        open(MIME, $mimemap) or return undef;
        while (<MIME>) {
                my ($mime, $exts) = split(/\t+/);
-               my @exts = split(/\s+/, $exts);
-               foreach my $ext (@exts) {
-                       $mimemap{$ext} = $mime;
+               if (defined $exts) {
+                       my @exts = split(/\s+/, $exts);
+                       foreach my $ext (@exts) {
+                               $mimemap{$ext} = $mime;
+                       }
                }
        }
        close(MIME);
@@ -1033,7 +1035,7 @@ sub git_print_page_path {
 
        if (!defined $name) {
                print "<div class=\"page_path\"><b>/</b></div>\n";
-       } elsif ($type =~ "blob") {
+       } elsif (defined $type && $type eq 'blob') {
                print "<div class=\"page_path\"><b>" .
                        $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;f=$file_name")}, esc_html($name)) . "</b><br/></div>\n";
        } else {
@@ -1433,7 +1435,7 @@ sub git_summary {
        my $headlist = git_read_refs("refs/heads");
        if (defined @$headlist) {
                git_header_div('heads');
-               git_heads_body($taglist, $head, 0, 15,
+               git_heads_body($headlist, $head, 0, 15,
                               $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=heads")}, "..."));
        }
 
@@ -1548,7 +1550,7 @@ sub git_blame {
                " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head");
        git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
        git_header_div('commit', esc_html($co{'title'}), $hash_base);
-       git_print_page_path($file_name);
+       git_print_page_path($file_name, 'blob');
        print "<div class=\"page_body\">\n";
        print <<HTML;
 <table class="blame">
@@ -1771,7 +1773,7 @@ sub git_tree {
        if (defined $file_name) {
                $base = esc_html("$file_name/");
        }
-       git_print_page_path($file_name);
+       git_print_page_path($file_name, 'tree');
        print "<div class=\"page_body\">\n";
        print "<table cellspacing=\"0\">\n";
        my $alternate = 0;
@@ -2301,7 +2303,7 @@ sub git_history {
                              "<td class=\"link\">" .
                              $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
                              " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
-                             " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
+                             " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$ftype;hb=$commit;f=$file_name")}, $ftype);
                        my $blob = git_get_hash_by_path($hash_base, $file_name);
                        my $blob_parent = git_get_hash_by_path($commit, $file_name);
                        if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
This page took 0.187074 seconds and 4 git commands to generate.