{"thread":{"id":"15337","subject":"[PATCH v7, resend] gitweb: ref markers link to named shortlogs","startedAt":"2008-09-02T19:47:05Z","lastAt":"2008-09-02T23:55:25Z","messageCount":5,"participants":["Giuseppe Bilotta","Petr Baudis","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":7,"patchTotal":null},"messages":[{"id":"89529","messageId":"1220384825-19824-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"15337","inReplyTo":null,"subject":"[PATCH v7, resend] gitweb: ref markers link to named shortlogs","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-09-02T19:47:05Z","receivedAt":"2008-09-02T19:47:05Z","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\nappropriate views for the ref name, depending on current context.\n\nFor annotated tags, we link to the tag view, unless that's the current\nview, in which case we switch to shortlog. For other refs, we prefer the\ncurrent view if it's history or (short)log, and default to shortlog\notherwise.\n\nAppropriate changes are made in the CSS to prevent ref markers from\nbeing annoyingly blue and underlined, unless hovered. A visual\nindication of the target view difference is also implemented by making\nannotated tags show up in italic.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n\nThis is a resend of v7 of the refmark patch, since it seems to\nhave falled again below the gitweb maintainers' radar, despite\ntheir interest in it ;)\n\n gitweb/gitweb.css  |   13 +++++++++++++\n gitweb/gitweb.perl |   37 ++++++++++++++++++++++++++++++++++---\n 2 files changed, 47 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.css b/gitweb/gitweb.css\nindex 5f4a4b8..3e50060 100644\n--- a/gitweb/gitweb.css\n+++ b/gitweb/gitweb.css\n@@ -491,6 +491,19 @@ 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 a:hover {\n+\ttext-decoration: underline;\n+}\n+\n+span.refs span.indirect {\n+\tfont-style: italic;\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 a0d9272..7536fc8 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1196,13 +1196,23 @@ sub format_log_line_html {\n }\n \n # format marker of refs pointing to given object\n+\n+# the destination action is chosen based on object type and current context:\n+# - for annotated tags, we choose the tag view unless it's the current view\n+#   already, in which case we go to shortlog view\n+# - for other refs, we keep the current view if we're in history, shortlog or\n+#   log view, and select shortlog otherwise\n sub format_ref_marker {\n \tmy ($refs, $id) = @_;\n \tmy $markers = '';\n \n \tif (defined $refs->{$id}) {\n \t\tforeach my $ref (@{$refs->{$id}}) {\n+\t\t\t# this code exploits the fact that non-lightweight tags are the\n+\t\t\t# only indirect objects, and that they are the only objects for which\n+\t\t\t# we want to use tag instead of shortlog as action\n \t\t\tmy ($type, $name) = qw();\n+\t\t\tmy $indirect = ($ref =~ s/\\^\\{\\}$//);\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@@ -1212,8 +1222,29 @@ sub format_ref_marker {\n \t\t\t\t$name = $ref;\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\tmy $class = $type;\n+\t\t\t$class .= \" indirect\" if $indirect;\n+\n+\t\t\tmy $dest_action = \"shortlog\";\n+\n+\t\t\tif ($indirect) {\n+\t\t\t\t$dest_action = \"tag\" unless $action eq \"tag\";\n+\t\t\t} elsif ($action =~ /^(history|(short)?log)$/) {\n+\t\t\t\t$dest_action = $action;\n+\t\t\t}\n+\n+\t\t\tmy $dest = \"\";\n+\t\t\t$dest .= \"refs/\" unless $ref =~ m!^refs/!;\n+\t\t\t$dest .= $ref;\n+\n+\t\t\tmy $link = $cgi->a({\n+\t\t\t\t-href => href(\n+\t\t\t\t\taction=>$dest_action,\n+\t\t\t\t\thash=>$dest\n+\t\t\t\t)}, $name);\n+\n+\t\t\t$markers .= \" <span class=\\\"$class\\\" title=\\\"$ref\\\">\" .\n+\t\t\t\t$link . \"</span>\";\n \t\t}\n \t}\n \n@@ -2035,7 +2066,7 @@ sub git_get_references {\n \n \twhile (my $line = <$fd>) {\n \t\tchomp $line;\n-\t\tif ($line =~ m!^([0-9a-fA-F]{40})\\srefs/($type/?[^^]+)!) {\n+\t\tif ($line =~ m!^([0-9a-fA-F]{40})\\srefs/($type.*)$!) {\n \t\t\tif (defined $refs{$1}) {\n \t\t\t\tpush @{$refs{$1}}, $2;\n \t\t\t} else {\n-- \n1.5.6.5\n"},{"id":"89548","messageId":"20080902211550.GR10360@machine.or.cz","threadId":"15337","inReplyTo":"1220384825-19824-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v7, resend] gitweb: ref markers link to named shortlogs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-02T21:15:50Z","receivedAt":"2008-09-02T21:15:50Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Tue, Sep 02, 2008 at 09:47:05PM +0200, Giuseppe Bilotta wrote:\n> This patch turns ref markers for tags and heads into links to\n> appropriate views for the ref name, depending on current context.\n> \n> For annotated tags, we link to the tag view, unless that's the current\n> view, in which case we switch to shortlog. For other refs, we prefer the\n> current view if it's history or (short)log, and default to shortlog\n> otherwise.\n> \n> Appropriate changes are made in the CSS to prevent ref markers from\n> being annoyingly blue and underlined, unless hovered. A visual\n> indication of the target view difference is also implemented by making\n> annotated tags show up in italic.\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n\nAcked-by: Petr Baudis <pasky@suse.cz>\n"},{"id":"89569","messageId":"200809030116.13676.jnareb@gmail.com","threadId":"15337","inReplyTo":"1220384825-19824-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH v7, resend] gitweb: ref markers link to named shortlogs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-09-02T23:16:12Z","receivedAt":"2008-09-02T23:16:12Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 2 Sep 2008, Giuseppe Bilotta wrote:\n\n> This patch turns ref markers for tags and heads into links to\n> appropriate views for the ref name, depending on current context.\n> \n> For annotated tags, we link to the tag view, unless that's the current\n> view, in which case we switch to shortlog. For other refs, we prefer the\n> current view if it's history or (short)log, and default to shortlog\n> otherwise.\n> \n> Appropriate changes are made in the CSS to prevent ref markers from\n> being annoyingly blue and underlined, unless hovered. A visual\n> indication of the target view difference is also implemented by making\n> annotated tags show up in italic.\n> \n> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n\nfor what it is worth...\n> ---\n> \n> This is a resend of v7 of the refmark patch, since it seems to\n> have falled again below the gitweb maintainers' radar, despite\n> their interest in it ;)\n\nUnfortunately there is not gitweb maintainer; nobody picked up\nthe mantle (although there are a few of unofficial gitweb \"gurus\").\n\n-- \nJakub Narebski\nShadeHawk on #git\nPoland\n"},{"id":"89570","messageId":"7v1w02i0xt.fsf@gitster.siamese.dyndns.org","threadId":"15337","inReplyTo":"200809030116.13676.jnareb@gmail.com","subject":"Re: [PATCH v7, resend] gitweb: ref markers link to named shortlogs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-09-02T23:26:54Z","receivedAt":"2008-09-02T23:26:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> On Tue, 2 Sep 2008, Giuseppe Bilotta wrote:\n>\n>> This patch turns ref markers for tags and heads into links to\n>> appropriate views for the ref name, depending on current context.\n>> \n>> For annotated tags, we link to the tag view, unless that's the current\n>> view, in which case we switch to shortlog. For other refs, we prefer the\n>> current view if it's history or (short)log, and default to shortlog\n>> otherwise.\n>> \n>> Appropriate changes are made in the CSS to prevent ref markers from\n>> being annoyingly blue and underlined, unless hovered. A visual\n>> indication of the target view difference is also implemented by making\n>> annotated tags show up in italic.\n>> \n>> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n>\n> Acked-by: Jakub Narebski <jnareb@gmail.com>\n\nThanks (and thanks, Pasky, too).  Will apply.\n"},{"id":"89575","messageId":"cb7bb73a0809021655t1c9c2863ub7e2771bf2ca3a83@mail.gmail.com","threadId":"15337","inReplyTo":"200809030116.13676.jnareb@gmail.com","subject":"Re: [PATCH v7, resend] gitweb: ref markers link to named shortlogs","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2008-09-02T23:55:25Z","receivedAt":"2008-09-02T23:55:25Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Wed, Sep 3, 2008 at 1:16 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n>\n> for what it is worth...\n>> ---\n>>\n>> This is a resend of v7 of the refmark patch, since it seems to\n>> have falled again below the gitweb maintainers' radar, despite\n>> their interest in it ;)\n>\n> Unfortunately there is not gitweb maintainer; nobody picked up\n> the mantle (although there are a few of unofficial gitweb \"gurus\").\n\nOh, that's ok, as long as I know I can bug you and Petr I'm happy ;)\nJust let me know if I become a little too insistent 8-D\n\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"}]}