]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
Fix showing of path in tree view
[Gitweb] / gitweb.perl
index b011a47f72357c5570742884ec1d469ba1d43163cd6d611a6bc22d984862f546..a308c0a30be5e5f207d6da8bc95b3c37e8d8d0e80881b3521d409a33dcf829ab 100755 (executable)
@@ -300,6 +300,7 @@ sub evaluate_path_info {
                $pathname =~ s,^/+,,;
                if (!$pathname || substr($pathname, -1) eq "/") {
                        $action  ||= "tree";
+                       $pathname =~ s,/$,,;
                } else {
                        $action  ||= "blob_plain";
                }
@@ -1513,12 +1514,15 @@ sub git_print_page_path {
                my $fullname = '';
 
                print "<div class=\"page_path\">";
+               print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
+                             -title => '/'}, '/');
+               print " ";
                foreach my $dir (@dirname) {
-                       $fullname .= $dir . '/';
+                       $fullname .= ($fullname ? '/' : '') . $dir;
                        print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
                                                     hash_base=>$hb),
-                                     -title => $fullname}, esc_html($dir));
-                       print "/";
+                                     -title => $fullname}, esc_html($dir . '/'));
+                       print " ";
                }
                if (defined $type && $type eq 'blob') {
                        print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
@@ -1527,8 +1531,7 @@ sub git_print_page_path {
                } elsif (defined $type && $type eq 'tree') {
                        print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
                                                     hash_base=>$hb),
-                                     -title => $name}, esc_html($basename));
-                       print "/";
+                                     -title => $name}, esc_html($basename . '/'));
                } else {
                        print esc_html($basename);
                }
@@ -2576,7 +2579,7 @@ sub git_tags {
        git_print_header_div('summary', $project);
 
        my ($taglist) = git_get_refs_list("tags");
-       if (defined @$taglist) {
+       if (@$taglist) {
                git_tags_body($taglist);
        }
        git_footer_html();
@@ -2589,7 +2592,7 @@ sub git_heads {
        git_print_header_div('summary', $project);
 
        my ($headlist) = git_get_refs_list("heads");
-       if (defined @$headlist) {
+       if (@$headlist) {
                git_heads_body($headlist, $head);
        }
        git_footer_html();
This page took 0.250187 seconds and 4 git commands to generate.