@matheusbsbs / matheus-bagliano / commits / 16fdb4882e
Fork 0

Fix showing of path in tree view

This patch fixes two things - links to all path elements except the last one were broken since gitweb does not like the trailing slash in them, and the root tree was not reachable from the subdirectory view. To compensate for the one more slash in the front, the trailing slash is not there anymore. ;-) I don't care if it stays there though. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>

Petr Baudis committed Sep 21, 2006 at 02:05 UTC 16fdb4882e3f7b5b60907a2729df494aaa1410a3
1 file changed +7 -5
gitweb/gitweb.perl
+7 -5
@@ -1514,12 +1514,15 @@ sub git_print_page_path {
1514 my $fullname = '';
1515
1516 print "<div class=\"page_path\">";
1517 + print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
1518 + -title => '/'}, '/');
1519 + print " ";
1520 foreach my $dir (@dirname) {
1518 - $fullname .= $dir . '/';
1521 + $fullname .= ($fullname ? '/' : '') . $dir;
1522 print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
1523 hash_base=>$hb),
1521 - -title => $fullname}, esc_html($dir));
1522 - print "/";
1524 + -title => $fullname}, esc_html($dir . '/'));
1525 + print " ";
1526 }
1527 if (defined $type && $type eq 'blob') {
1528 print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
@@ -1528,8 +1531,7 @@ sub git_print_page_path {
1531 } elsif (defined $type && $type eq 'tree') {
1532 print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
1533 hash_base=>$hb),
1531 - -title => $name}, esc_html($basename));
1532 - print "/";
1534 + -title => $name}, esc_html($basename . '/'));
1535 } else {
1536 print esc_html($basename);
1537 }