From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: git@vger.kernel.org
Cc: Jakub Narebski <jnareb@gmail.com>, Petr Baudis <pasky@ucw.cz>,
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [PATCHv2] gitweb: ref markers link to named shortlogs
Date: Sun, 3 Aug 2008 22:48:30 +0200 [thread overview]
Message-ID: <1217796510-379-1-git-send-email-giuseppe.bilotta@gmail.com> (raw)
In-Reply-To: <20080803132050.GA10151@machine.or.cz>
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@gmail.com>
---
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
prev parent reply other threads:[~2008-08-03 20:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-02 15:39 [PATCH] gitweb: ref markers link to named shortlogs Giuseppe Bilotta
2008-08-03 12:03 ` Petr Baudis
2008-08-03 13:14 ` Giuseppe Bilotta
2008-08-03 13:20 ` Petr Baudis
2008-08-03 20:48 ` Giuseppe Bilotta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1217796510-379-1-git-send-email-giuseppe.bilotta@gmail.com \
--to=giuseppe.bilotta@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=pasky@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).