summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4df118e)
raw | patch | inline | side by side (parent: 4df118e)
author | Jakub Narebski <jnareb@gmail.com> | |
Sat, 21 Oct 2006 15:54:44 +0000 (17:54 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 23 Oct 2006 05:54:08 +0000 (22:54 -0700) |
Adds '..' (up directory) link at the top of "tree" view listing,
if both $hash_base and $file_name are provided, and $file_name
is not empty string.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
if both $hash_base and $file_name are provided, and $file_name
is not empty string.
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 126cf3c2e2f76fbf6d41a3f1e8f674b8c59637fb..c9e57f05160df44d790126ce1c11b54ec622be47 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
print "<div class=\"page_body\">\n";
print "<table cellspacing=\"0\">\n";
my $alternate = 1;
+ # '..' (top directory) link if possible
+ if (defined $hash_base &&
+ defined $file_name && $file_name =~ m![^/]+$!) {
+ if ($alternate) {
+ print "<tr class=\"dark\">\n";
+ } else {
+ print "<tr class=\"light\">\n";
+ }
+ $alternate ^= 1;
+
+ my $up = $file_name;
+ $up =~ s!/?[^/]+$!!;
+ undef $up unless $up;
+ # based on git_print_tree_entry
+ print '<td class="mode">' . mode_str('040000') . "</td>\n";
+ print '<td class="list">';
+ print $cgi->a({-href => href(action=>"tree", hash_base=>$hash_base,
+ file_name=>$up)},
+ "..");
+ print "</td>\n";
+ print "<td class=\"link\"></td>\n";
+
+ print "</tr>\n";
+ }
foreach my $line (@entries) {
my %t = parse_ls_tree_line($line, -z => 1);