Commit 762c7205 authored by Jakub Narębski's avatar Jakub Narębski Committed by Junio C Hamano

gitweb: Divide page path into directories -- path's "breadcrumbs"

Divide page path into directories, so that each part of path links to
the "tree" view of the $hash_base (or HEAD, if $hash_base is not set)
version of the directory.

If the entity is blob, final part (basename) links to $hash_base or
HEAD revision of the "raw" blob ("blob_plain" view).  If the entity is
tree, link to the "tree" view.
Signed-off-by: Jakub Narębski's avatarJakub Narebski <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 72dbafa1
......@@ -1405,19 +1405,32 @@ sub git_print_page_path {
if (!defined $name) {
print "<div class=\"page_path\">/</div>\n";
} elsif (defined $type && $type eq 'blob') {
} else {
my @dirname = split '/', $name;
my $basename = pop @dirname;
my $fullname = '';
print "<div class=\"page_path\">";
if (defined $hb) {
foreach my $dir (@dirname) {
$fullname .= $dir . '/';
print $cgi->a({-href => href(action=>"tree", file_name=>$fullname,
-title => $fullname}, esc_html($dir));
print "/";
if (defined $type && $type eq 'blob') {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
-title => $name}, esc_html($basename));
} elsif (defined $type && $type eq 'tree') {
print $cgi->a({-href => href(action=>"tree", file_name=>$file_name,
-title => $name}, esc_html($basename));
print "/";
} else {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)},
print esc_html($basename);
print "<br/></div>\n";
} else {
print "<div class=\"page_path\">" . esc_html($name) . "<br/></div>\n";
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment