This patch turns ref markers for tags and heads into links to appropriate views for the ref name. Appropriate changes are made in the CSS to prevent ref markers to be annoyingly blue and underlined. For all git ref types it's assumed that the preferred view is named like the ref type itself. For commits, we map the view to shortlog. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx> --- Following pasky's suggestion, the action used by the ref marker is now determined from the ref type, default action to the ref type itsef. Currently the only non-default action is shortlog for commit refs, but the map can be expanded as needed. gitweb/gitweb.css | 5 +++++ gitweb/gitweb.perl | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index aa0eeca..2b43eea 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -481,6 +481,11 @@ span.refs span { border-color: #ffccff #ff00ee #ff00ee #ffccff; } +span.refs span a { + text-decoration: none; + color: inherit; +} + span.refs span.ref { background-color: #aaaaff; border-color: #ccccff #0033cc #0033cc #ccccff; diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 90cd99b..a12ce87 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1093,10 +1093,14 @@ sub format_log_line_html { sub format_ref_marker { my ($refs, $id) = @_; my $markers = ''; + my %view = ( + "commit" => "shortlog", + ); if (defined $refs->{$id}) { foreach my $ref (@{$refs->{$id}}) { my ($type, $name) = qw(); + my $git_type = git_get_type($ref); # e.g. tags/v2.6.11 or heads/next if ($ref =~ m!^(.*?)s?/(.*)$!) { $type = $1; @@ -1107,7 +1111,8 @@ sub format_ref_marker { } $markers .= " <span class=\"$type\" title=\"$ref\">" . - esc_html($name) . "</span>"; + $cgi->a({-href => href(action=>$view{$git_type} || $git_type, hash=>$name)}, $name) . + "</span>"; } } -- 1.5.6.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html