summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 72dbafa)
raw | patch | inline | side by side (parent: 72dbafa)
author | Jakub Narebski <jnareb@gmail.com> | |
Mon, 4 Sep 2006 16:17:58 +0000 (18:17 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 4 Sep 2006 22:46:44 +0000 (15:46 -0700) |
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 Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6acbb5ef557139046653690870aad8a570690206..d89f709d1361e45f8d3f6ce9eb74430d9ff0d94d 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
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,
+ hash_base=>$hb),
+ -title => $fullname}, esc_html($dir));
+ print "/";
+ }
+ if (defined $type && $type eq 'blob') {
print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name,
- hash_base=>$hb)},
- esc_html($name));
+ hash_base=>$hb),
+ -title => $name}, esc_html($basename));
+ } 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 "/";
} else {
- print $cgi->a({-href => href(action=>"blob_plain", file_name=>$file_name)},
- esc_html($name));
+ print esc_html($basename);
}
print "<br/></div>\n";
- } else {
- print "<div class=\"page_path\">" . esc_html($name) . "<br/></div>\n";
}
}