[PATCH] gitweb: ref markers link to named shortlogs

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] gitweb: ref markers link to named shortlogs

Giuseppe Bilotta-3
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 <[hidden email]>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] gitweb: ref markers link to named shortlogs

Petr Baudis
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 <[hidden email]>

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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] gitweb: ref markers link to named shortlogs

Giuseppe Bilotta-3
On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <[hidden email]> 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 <[hidden email]>
>
> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] gitweb: ref markers link to named shortlogs

Petr Baudis
On Sun, Aug 03, 2008 at 03:14:09PM +0200, Giuseppe Bilotta wrote:

> On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <[hidden email]> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

[PATCHv2] gitweb: ref markers link to named shortlogs

Giuseppe Bilotta-3
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 <[hidden email]>
---

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 [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html