Skip to content

Commit 4777b01

Browse files
Petr BaudisJunio C Hamano
authored andcommitted
gitweb: Restore object-named links in item lists
This restores the redundant links removed earlier. It supersedes my patch to stick slashes to tree entries. Sorry about the previous version of the patch, an unrelated snapshot link addition to tree entries slipped through (and it it didn't even compile); I've dropped the idea of snapshot links in tree entries in the meantime anyway. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent ccbb3d1 commit 4777b01

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

gitweb/gitweb.perl

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,16 +1789,18 @@ sub git_print_tree_entry {
17891789
file_name=>"$basedir$t->{'name'}", %base_key),
17901790
-class => "list"}, esc_html($t->{'name'})) . "</td>\n";
17911791
print "<td class=\"link\">";
1792+
print $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
1793+
file_name=>"$basedir$t->{'name'}", %base_key)},
1794+
"blob");
17921795
if ($have_blame) {
1793-
print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
1796+
print " | " .
1797+
$cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
17941798
file_name=>"$basedir$t->{'name'}", %base_key)},
17951799
"blame");
17961800
}
17971801
if (defined $hash_base) {
1798-
if ($have_blame) {
1799-
print " | ";
1800-
}
1801-
print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
1802+
print " | " .
1803+
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
18021804
hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
18031805
"history");
18041806
}
@@ -1815,8 +1817,12 @@ sub git_print_tree_entry {
18151817
esc_html($t->{'name'}));
18161818
print "</td>\n";
18171819
print "<td class=\"link\">";
1820+
print $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
1821+
file_name=>"$basedir$t->{'name'}", %base_key)},
1822+
"tree");
18181823
if (defined $hash_base) {
1819-
print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
1824+
print " | " .
1825+
$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
18201826
file_name=>"$basedir$t->{'name'}")},
18211827
"history");
18221828
}
@@ -1899,6 +1905,9 @@ sub git_difftree_body {
18991905
print $cgi->a({-href => "#patch$patchno"}, "patch");
19001906
print " | ";
19011907
}
1908+
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
1909+
hash_base=>$parent, file_name=>$diff{'file'})},
1910+
"blob") . " | ";
19021911
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
19031912
file_name=>$diff{'file'})},
19041913
"blame") . " | ";
@@ -1944,6 +1953,9 @@ sub git_difftree_body {
19441953
}
19451954
print " | ";
19461955
}
1956+
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1957+
hash_base=>$hash, file_name=>$diff{'file'})},
1958+
"blob") . " | ";
19471959
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
19481960
file_name=>$diff{'file'})},
19491961
"blame") . " | ";
@@ -1984,6 +1996,9 @@ sub git_difftree_body {
19841996
}
19851997
print " | ";
19861998
}
1999+
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
2000+
hash_base=>$parent, file_name=>$diff{'from_file'})},
2001+
"blob") . " | ";
19872002
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
19882003
file_name=>$diff{'from_file'})},
19892004
"blame") . " | ";
@@ -2151,6 +2166,7 @@ sub git_shortlog_body {
21512166
href(action=>"commit", hash=>$commit), $ref);
21522167
print "</td>\n" .
21532168
"<td class=\"link\">" .
2169+
$cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
21542170
$cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
21552171
$cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
21562172
if (gitweb_have_snapshot()) {

0 commit comments

Comments
 (0)