Thread (17 messages) flat view 17 messages, 3 authors, 2016-06-15
STALE3711d

[PATCH] gitweb: ref markers link to named shortlogs

From: Giuseppe Bilotta <hidden>
Date: 2016-06-15 22:45:12
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---

This is a resend of version 2 of the patch, as it seems to have
dropped into oblivion without ACKs or NACKs.

 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help