[PATCHv3] gitweb: ref markers link to named shortlogs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch turns ref markers into links to appropriate views for the ref
name, using the full ref name as hash. Appropriate changes are made in
the CSS to prevent ref markers to be annoyingly blue and underlined,
unless hovered on.

For all git ref types it's assumed that the preferred view is named like
the ref type itself. If the corresponding action is not defined,
shortlog is used.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx>
---

Following Jakub Narebski's suggestions, an underlined :hover is
added for the ref marker css, and we use $type instead of
$git_type, sparing ourselves a bunch of git calls.

An additional change wrt the previous version is that the full ref
name is used (to link to the correct object when e.g. a head and a
tag by the same name exist).

 gitweb/gitweb.css  |    9 +++++++++
 gitweb/gitweb.perl |    3 ++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index aa0eeca..fadce1b 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -481,6 +481,15 @@ span.refs span {
 	border-color: #ffccff #ff00ee #ff00ee #ffccff;
 }
 
+span.refs span a {
+	text-decoration: none;
+	color: inherit;
+}
+
+span.refs span a:hover {
+	text-decoration: underline;
+}
+
 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..77b2442 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1107,7 +1107,8 @@ sub format_ref_marker {
 			}
 
 			$markers .= " <span class=\"$type\" title=\"$ref\">" .
-			            esc_html($name) . "</span>";
+				$cgi->a({-href => href(action=> $actions{$type} || "shortlog", hash=>$ref)}, $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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux