Skip to content

Commit

Permalink
gitweb: Improve git_print_page_path
Browse files Browse the repository at this point in the history
Add link to "tree root" (root directory) also for not defined name,
for example for "tree" action without defined "file_name" which means
"tree root".

Add " / " at the end of path when $type eq "tree".

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Oct 23, 2006
1 parent 05eb811 commit 4df118e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1615,17 +1615,16 @@ sub git_print_page_path {
my $type = shift;
my $hb = shift;

if (!defined $name) {
print "<div class=\"page_path\">/</div>\n";
} else {

print "<div class=\"page_path\">";
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
-title => 'tree root'}, "[$project]");
print " / ";
if (defined $name) {
my @dirname = split '/', $name;
my $basename = pop @dirname;
my $fullname = '';

print "<div class=\"page_path\">";
print $cgi->a({-href => href(action=>"tree", hash_base=>$hb),
-title => 'tree root'}, "[$project]");
print " / ";
foreach my $dir (@dirname) {
$fullname .= ($fullname ? '/' : '') . $dir;
print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
Expand All @@ -1641,11 +1640,12 @@ sub git_print_page_path {
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
hash_base=>$hb),
-title => $name}, esc_html($basename));
print " / ";
} else {
print esc_html($basename);
}
print "<br/></div>\n";
}
print "<br/></div>\n";
}

# sub git_print_log (\@;%) {
Expand Down

0 comments on commit 4df118e

Please sign in to comment.