From: Jakub Narebski Date: Sat, 21 Oct 2006 15:54:44 +0000 (+0200) Subject: gitweb: Add '..' (up directory) to tree view if applicable X-Git-Tag: v1.4.4-rc1~75 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b6b7fc7283bd091822541c0286340e78b0c497a2;p=git.git gitweb: Add '..' (up directory) to tree view if applicable 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 Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 126cf3c2e..c9e57f051 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2871,6 +2871,30 @@ sub git_tree { print "
\n"; print "\n"; my $alternate = 1; + # '..' (top directory) link if possible + if (defined $hash_base && + defined $file_name && $file_name =~ m![^/]+$!) { + if ($alternate) { + print "\n"; + } else { + print "\n"; + } + $alternate ^= 1; + + my $up = $file_name; + $up =~ s!/?[^/]+$!!; + undef $up unless $up; + # based on git_print_tree_entry + print '\n"; + print '\n"; + print "\n"; + + print "\n"; + } foreach my $line (@entries) { my %t = parse_ls_tree_line($line, -z => 1);
' . mode_str('040000') . "'; + print $cgi->a({-href => href(action=>"tree", hash_base=>$hash_base, + file_name=>$up)}, + ".."); + print "