git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: ref markers link to named shortlogs
@ 2008-08-02 15:39 Giuseppe Bilotta
  2008-08-03 12:03 ` Petr Baudis
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe Bilotta @ 2008-08-02 15:39 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Petr Baudis, Giuseppe Bilotta

This patch turns ref markers for tags and heads into links to
shortlog/refname. Appropriate changes are made in the CSS to prevent ref
markers to be annoyingly blue and underlined.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
 gitweb/gitweb.css  |    5 +++++
 gitweb/gitweb.perl |    5 ++++-
 2 files changed, 9 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..7f391fa 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1093,6 +1093,7 @@ sub format_log_line_html {
 sub format_ref_marker {
 	my ($refs, $id) = @_;
 	my $markers = '';
+	my $htmltext;
 
 	if (defined $refs->{$id}) {
 		foreach my $ref (@{$refs->{$id}}) {
@@ -1101,13 +1102,15 @@ sub format_ref_marker {
 			if ($ref =~ m!^(.*?)s?/(.*)$!) {
 				$type = $1;
 				$name = $2;
+				$htmltext = $cgi->a({-href => href(action=>"shortlog", hash=>$name)}, $name);
 			} else {
 				$type = "ref";
 				$name = $ref;
+				$htmltext = esc_html($name);
 			}
 
 			$markers .= " <span class=\"$type\" title=\"$ref\">" .
-			            esc_html($name) . "</span>";
+			            $htmltext . "</span>";
 		}
 	}
 
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: ref markers link to named shortlogs
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Baudis @ 2008-08-03 12:03 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: git, Jakub Narebski

On Sat, Aug 02, 2008 at 05:39:14PM +0200, Giuseppe Bilotta wrote:
> This patch turns ref markers for tags and heads into links to
> shortlog/refname. Appropriate changes are made in the CSS to prevent ref
> markers to be annoyingly blue and underlined.
> 
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>

I think this is good idea in principle, but

	(i) Why not do this for all the refs?

	(ii) I think you should decide on the type of the action based
on the object type of the ref; actually, any kind of object type can be
ref'd, and for tags you would rather want tag view, etc. (The tag view
actually sucks and should behave more like git show tag - i.e. append
the appropriate view after the tag info - but that is different matter.)

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: ref markers link to named shortlogs
  2008-08-03 12:03 ` Petr Baudis
@ 2008-08-03 13:14   ` Giuseppe Bilotta
  2008-08-03 13:20     ` Petr Baudis
  0 siblings, 1 reply; 5+ messages in thread
From: Giuseppe Bilotta @ 2008-08-03 13:14 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git, Jakub Narebski

On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <pasky@suse.cz> wrote:
> On Sat, Aug 02, 2008 at 05:39:14PM +0200, Giuseppe Bilotta wrote:
>> This patch turns ref markers for tags and heads into links to
>> shortlog/refname. Appropriate changes are made in the CSS to prevent ref
>> markers to be annoyingly blue and underlined.
>>
>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
>
> I think this is good idea in principle, but
>
>        (i) Why not do this for all the refs?
>
>        (ii) I think you should decide on the type of the action based
> on the object type of the ref; actually, any kind of object type can be
> ref'd, and for tags you would rather want tag view, etc. (The tag view
> actually sucks and should behave more like git show tag - i.e. append
> the appropriate view after the tag info - but that is different matter.)

Funny that. My original plan was to have a different action depending
on tag (I tried shortlog for tag and commitdiff for branch). And since
I I had no idea what kind of action to use for 'generic' refs, I left
them out. Then I had second thoughts and started using shortlog for
both heads and tags, and collapsed the code but still kept the generic
refs out of the way. So maybe we can use shortlog as default action
and single out tags (and whatever else we'll find to need a different
action)?



-- 
Giuseppe "Oblomov" Bilotta

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gitweb: ref markers link to named shortlogs
  2008-08-03 13:14   ` Giuseppe Bilotta
@ 2008-08-03 13:20     ` Petr Baudis
  2008-08-03 20:48       ` [PATCHv2] " Giuseppe Bilotta
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Baudis @ 2008-08-03 13:20 UTC (permalink / raw)
  To: Giuseppe Bilotta; +Cc: git, Jakub Narebski

On Sun, Aug 03, 2008 at 03:14:09PM +0200, Giuseppe Bilotta wrote:
> On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <pasky@suse.cz> wrote:
> >        (ii) I think you should decide on the type of the action based
> > on the object type of the ref; actually, any kind of object type can be
> > ref'd, and for tags you would rather want tag view, etc. (The tag view
> > actually sucks and should behave more like git show tag - i.e. append
> > the appropriate view after the tag info - but that is different matter.)
> 
> Funny that. My original plan was to have a different action depending
> on tag (I tried shortlog for tag and commitdiff for branch). And since
> I I had no idea what kind of action to use for 'generic' refs, I left
> them out. Then I had second thoughts and started using shortlog for
> both heads and tags, and collapsed the code but still kept the generic
> refs out of the way. So maybe we can use shortlog as default action
> and single out tags (and whatever else we'll find to need a different
> action)?

What's wrong with my proposed approach to choose actoin based on object
type of the ref?

-- 
				Petr "Pasky" Baudis
The next generation of interesting software will be done
on the Macintosh, not the IBM PC.  -- Bill Gates

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2] gitweb: ref markers link to named shortlogs
  2008-08-03 13:20     ` Petr Baudis
@ 2008-08-03 20:48       ` Giuseppe Bilotta
  0 siblings, 0 replies; 5+ messages in thread
From: Giuseppe Bilotta @ 2008-08-03 20:48 UTC (permalink / raw)
  To: git; +Cc: Jakub Narebski, Petr Baudis, Giuseppe Bilotta

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-03 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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       ` [PATCHv2] " Giuseppe Bilotta

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).