{"thread":{"id":"14811","subject":"[PATCH] gitweb: ref markers link to named shortlogs","startedAt":"2008-08-02T15:39:14Z","lastAt":"2008-08-03T20:48:30Z","messageCount":5,"participants":["Giuseppe Bilotta","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"85982","messageId":"1217691554-10407-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"14811","inReplyTo":null,"subject":"[PATCH] gitweb: ref markers link to named shortlogs","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-08-02T15:39:14Z","receivedAt":"2008-08-02T15:39:14Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This patch turns ref markers for tags and heads into links to\nshortlog/refname. Appropriate changes are made in the CSS to prevent ref\nmarkers to be annoyingly blue and underlined.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.css  |    5 +++++\n gitweb/gitweb.perl |    5 ++++-\n 2 files changed, 9 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex aa0eeca..2b43eea 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -481,6 +481,11 @@ span.refs span {\n \tborder-color: #ffccff #ff00ee #ff00ee #ffccff;\n }\n \n+span.refs span a {\n+\ttext-decoration: none;\n+\tcolor: inherit;\n+}\n+\n span.refs span.ref {\n \tbackground-color: #aaaaff;\n \tborder-color: #ccccff #0033cc #0033cc #ccccff;\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 90cd99b..7f391fa 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1093,6 +1093,7 @@ sub format_log_line_html {\n sub format_ref_marker {\n \tmy ($refs, $id) = @_;\n \tmy $markers = '';\n+\tmy $htmltext;\n \n \tif (defined $refs->{$id}) {\n \t\tforeach my $ref (@{$refs->{$id}}) {\n@@ -1101,13 +1102,15 @@ sub format_ref_marker {\n \t\t\tif ($ref =~ m!^(.*?)s?/(.*)$!) {\n \t\t\t\t$type = $1;\n \t\t\t\t$name = $2;\n+\t\t\t\t$htmltext = $cgi->a({-href => href(action=>\"shortlog\", hash=>$name)}, $name);\n \t\t\t} else {\n \t\t\t\t$type = \"ref\";\n \t\t\t\t$name = $ref;\n+\t\t\t\t$htmltext = esc_html($name);\n \t\t\t}\n \n \t\t\t$markers .= \" <span class=\\\"$type\\\" title=\\\"$ref\\\">\" .\n-\t\t\t            esc_html($name) . \"</span>\";\n+\t\t\t            $htmltext . \"</span>\";\n \t\t}\n \t}\n \n-- \n1.5.6.3\n"},{"id":"86067","messageId":"20080803120350.GW32184@machine.or.cz","threadId":"14811","inReplyTo":"1217691554-10407-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH] gitweb: ref markers link to named shortlogs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-08-03T12:03:50Z","receivedAt":"2008-08-03T12:03:50Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Sat, Aug 02, 2008 at 05:39:14PM +0200, Giuseppe Bilotta wrote:\n> This patch turns ref markers for tags and heads into links to\n> shortlog/refname. Appropriate changes are made in the CSS to prevent ref\n> markers to be annoyingly blue and underlined.\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n\nI think this is good idea in principle, but\n\n\t(i) Why not do this for all the refs?\n\n\t(ii) I think you should decide on the type of the action based\non the object type of the ref; actually, any kind of object type can be\nref'd, and for tags you would rather want tag view, etc. (The tag view\nactually sucks and should behave more like git show tag - i.e. append\nthe appropriate view after the tag info - but that is different matter.)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"},{"id":"86070","messageId":"cb7bb73a0808030614v260dea2ek6757b7a22b13afa2@mail.gmail.com","threadId":"14811","inReplyTo":"20080803120350.GW32184@machine.or.cz","subject":"Re: [PATCH] gitweb: ref markers link to named shortlogs","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-08-03T13:14:09Z","receivedAt":"2008-08-03T13:14:09Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <pasky@suse.cz> wrote:\n> On Sat, Aug 02, 2008 at 05:39:14PM +0200, Giuseppe Bilotta wrote:\n>> This patch turns ref markers for tags and heads into links to\n>> shortlog/refname. Appropriate changes are made in the CSS to prevent ref\n>> markers to be annoyingly blue and underlined.\n>>\n>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n>\n> I think this is good idea in principle, but\n>\n>        (i) Why not do this for all the refs?\n>\n>        (ii) I think you should decide on the type of the action based\n> on the object type of the ref; actually, any kind of object type can be\n> ref'd, and for tags you would rather want tag view, etc. (The tag view\n> actually sucks and should behave more like git show tag - i.e. append\n> the appropriate view after the tag info - but that is different matter.)\n\nFunny that. My original plan was to have a different action depending\non tag (I tried shortlog for tag and commitdiff for branch). And since\nI I had no idea what kind of action to use for 'generic' refs, I left\nthem out. Then I had second thoughts and started using shortlog for\nboth heads and tags, and collapsed the code but still kept the generic\nrefs out of the way. So maybe we can use shortlog as default action\nand single out tags (and whatever else we'll find to need a different\naction)?\n\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"86071","messageId":"20080803132050.GA10151@machine.or.cz","threadId":"14811","inReplyTo":"cb7bb73a0808030614v260dea2ek6757b7a22b13afa2@mail.gmail.com","subject":"Re: [PATCH] gitweb: ref markers link to named shortlogs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-08-03T13:20:50Z","receivedAt":"2008-08-03T13:20:50Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Sun, Aug 03, 2008 at 03:14:09PM +0200, Giuseppe Bilotta wrote:\n> On Sun, Aug 3, 2008 at 2:03 PM, Petr Baudis <pasky@suse.cz> wrote:\n> >        (ii) I think you should decide on the type of the action based\n> > on the object type of the ref; actually, any kind of object type can be\n> > ref'd, and for tags you would rather want tag view, etc. (The tag view\n> > actually sucks and should behave more like git show tag - i.e. append\n> > the appropriate view after the tag info - but that is different matter.)\n> \n> Funny that. My original plan was to have a different action depending\n> on tag (I tried shortlog for tag and commitdiff for branch). And since\n> I I had no idea what kind of action to use for 'generic' refs, I left\n> them out. Then I had second thoughts and started using shortlog for\n> both heads and tags, and collapsed the code but still kept the generic\n> refs out of the way. So maybe we can use shortlog as default action\n> and single out tags (and whatever else we'll find to need a different\n> action)?\n\nWhat's wrong with my proposed approach to choose actoin based on object\ntype of the ref?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nThe next generation of interesting software will be done\non the Macintosh, not the IBM PC.  -- Bill Gates\n"},{"id":"86103","messageId":"1217796510-379-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"14811","inReplyTo":"20080803132050.GA10151@machine.or.cz","subject":"[PATCHv2] gitweb: ref markers link to named shortlogs","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-08-03T20:48:30Z","receivedAt":"2008-08-03T20:48:30Z","isPatch":false,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"This patch turns ref markers for tags and heads into links to\nappropriate views for the ref name. Appropriate changes are made in the\nCSS to prevent ref markers to be annoyingly blue and underlined.\n\nFor all git ref types it's assumed that the preferred view is named like\nthe ref type itself. For commits, we map the view to shortlog.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n\nFollowing pasky's suggestion, the action used by the ref marker\nis now determined from the ref type, default action to the ref type\nitsef. Currently the only non-default action is shortlog for commit\nrefs, but the map can be expanded as needed.\n\n gitweb/gitweb.css  |    5 +++++\n gitweb/gitweb.perl |    7 ++++++-\n 2 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex aa0eeca..2b43eea 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -481,6 +481,11 @@ span.refs span {\n \tborder-color: #ffccff #ff00ee #ff00ee #ffccff;\n }\n \n+span.refs span a {\n+\ttext-decoration: none;\n+\tcolor: inherit;\n+}\n+\n span.refs span.ref {\n \tbackground-color: #aaaaff;\n \tborder-color: #ccccff #0033cc #0033cc #ccccff;\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 90cd99b..a12ce87 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1093,10 +1093,14 @@ sub format_log_line_html {\n sub format_ref_marker {\n \tmy ($refs, $id) = @_;\n \tmy $markers = '';\n+\tmy %view = (\n+\t\t\"commit\" => \"shortlog\",\n+\t);\n \n \tif (defined $refs->{$id}) {\n \t\tforeach my $ref (@{$refs->{$id}}) {\n \t\t\tmy ($type, $name) = qw();\n+\t\t\tmy $git_type = git_get_type($ref);\n \t\t\t# e.g. tags/v2.6.11 or heads/next\n \t\t\tif ($ref =~ m!^(.*?)s?/(.*)$!) {\n \t\t\t\t$type = $1;\n@@ -1107,7 +1111,8 @@ sub format_ref_marker {\n \t\t\t}\n \n \t\t\t$markers .= \" <span class=\\\"$type\\\" title=\\\"$ref\\\">\" .\n-\t\t\t            esc_html($name) . \"</span>\";\n+\t\t\t\t$cgi->a({-href => href(action=>$view{$git_type} || $git_type, hash=>$name)}, $name) .\n+\t\t\t\t\"</span>\";\n \t\t}\n \t}\n \n-- \n1.5.6.3\n"}]}