{"thread":{"id":"4606","subject":"[PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed","startedAt":"2006-06-21T22:42:22Z","lastAt":"2006-06-22T06:54:32Z","messageCount":3,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22225","messageId":"11509297422173-git-send-email-jnareb@gmail.com","threadId":"4606","inReplyTo":null,"subject":"[PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-21T22:42:22Z","receivedAt":"2006-06-21T22:42:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"For commits in oneline view (summary, shortlog, history) commit title\n(first line of commit message) is link to commit itself. If commit title\n(commit description) is shortened in output, hyperlink has title attribute\nwith full title.\n\nThis commit does the same also for tags. It is much more rare to have long\ntag description, though.\n\nMisfeature: sometimes tag link has title attribute even if tag description\ndoesn't seem to be shortened.\n\nNeeds refactoring (twice done almost exactly the same, four times similar\ncode is used).\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n\n---\n\n gitweb/gitweb.cgi |   22 ++++++++++++++++------\n 1 files changed, 16 insertions(+), 6 deletions(-)\n\ne41a09e140c1ecd933ae90e7b55660d67f33dc1b\ndiff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi\nindex e044c61..8f8ae4a 100755\n--- a/gitweb/gitweb.cgi\n+++ b/gitweb/gitweb.cgi\n@@ -326,7 +326,7 @@ EOF\n \t\t} elsif (defined $hash) {\n \t\t\t$search_hash = $hash;\n \t\t} else {\n-\t\t\t$search_hash  = \"HEAD\";\n+\t\t\t$search_hash = \"HEAD\";\n \t\t}\n \t\t$cgi->param(\"a\", \"search\");\n \t\t$cgi->param(\"h\", $search_hash);\n@@ -1107,7 +1107,8 @@ sub git_summary {\n \t\tforeach my $entry (@$taglist) {\n \t\t\tmy %tag = %$entry;\n \t\t\tmy $comment_lines = $tag{'comment'};\n-\t\t\tmy $comment = shift @$comment_lines;\n+\t\t\tmy $comment_long = shift @$comment_lines;\n+\t\t\tmy $comment = $comment_long;\n \t\t\tif (defined($comment)) {\n \t\t\t\t$comment = chop_str($comment, 30, 5);\n \t\t\t}\n@@ -1119,13 +1120,17 @@ sub git_summary {\n \t\t\t$alternate ^= 1;\n \t\t\tif ($i-- > 0) {\n \t\t\t\tprint \"<td><i>$tag{'age'}</i></td>\\n\" .\n-\t\t\t\t      \"<td>\" .\n+\t\t\t\t      \"<td>\";\n \t\t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=$tag{'reftype'};h=$tag{'refid'}\"), -class => \"list\"},\n \t\t\t\t      \"<b>\" . esc_html($tag{'name'}) . \"</b>\") .\n \t\t\t\t      \"</td>\\n\" .\n \t\t\t\t      \"<td>\";\n \t\t\t\tif (defined($comment)) {\n-\t\t\t\t      print $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n+\t\t\t\t\tif (length($comment) < length($comment_long)) {\n+\t\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\"), -title => \"$comment_long\"}, $comment);\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n+\t\t\t\t\t}\n \t\t\t\t}\n \t\t\t\tprint \"</td>\\n\" .\n \t\t\t\t      \"<td class=\\\"link\\\">\";\n@@ -1346,7 +1351,8 @@ sub git_tags {\n \t\tforeach my $entry (@$taglist) {\n \t\t\tmy %tag = %$entry;\n \t\t\tmy $comment_lines = $tag{'comment'};\n-\t\t\tmy $comment = shift @$comment_lines;\n+\t\t\tmy $comment_long = shift @$comment_lines;\n+\t\t\tmy $comment = $comment_long;\n \t\t\tif (defined($comment)) {\n \t\t\t\t$comment = chop_str($comment, 30, 5);\n \t\t\t}\n@@ -1363,7 +1369,11 @@ sub git_tags {\n \t\t\t      \"</td>\\n\" .\n \t\t\t      \"<td>\";\n \t\t\tif (defined($comment)) {\n-\t\t\t      print $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n+\t\t\t\tif (length($comment) < length($comment_long)) {\n+\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\"), -title => \"$comment_long\"}, $comment);\n+\t\t\t\t} else {\n+\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n+\t\t\t\t}\n \t\t\t}\n \t\t\tprint \"</td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\";\n-- \n1.3.0\n"},{"id":"22226","messageId":"7vu06exfym.fsf@assigned-by-dhcp.cox.net","threadId":"4606","inReplyTo":"11509297422173-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-21T23:10:41Z","receivedAt":"2006-06-21T23:10:41Z","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> For commits in oneline view (summary, shortlog, history) commit title\n> (first line of commit message) is link to commit itself. If commit title\n> (commit description) is shortened in output, hyperlink has title attribute\n> with full title.\n\nThere are pure fixes and this \"-title\" enhancement intermixed.\nCan we have fixes-only first?\n\n> diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi\n> index e044c61..8f8ae4a 100755\n> --- a/gitweb/gitweb.cgi\n> +++ b/gitweb/gitweb.cgi\n> @@ -326,7 +326,7 @@ EOF\n>  \t\t} elsif (defined $hash) {\n>  \t\t\t$search_hash = $hash;\n>  \t\t} else {\n> -\t\t\t$search_hash  = \"HEAD\";\n> +\t\t\t$search_hash = \"HEAD\";\n>  \t\t}\n>  \t\t$cgi->param(\"a\", \"search\");\n>  \t\t$cgi->param(\"h\", $search_hash);\n\nIs a fix.\n\n> @@ -1107,7 +1107,8 @@ sub git_summary {\n>  \t\tforeach my $entry (@$taglist) {\n>  \t\t\tmy %tag = %$entry;\n>  \t\t\tmy $comment_lines = $tag{'comment'};\n> -\t\t\tmy $comment = shift @$comment_lines;\n> +\t\t\tmy $comment_long = shift @$comment_lines;\n> +\t\t\tmy $comment = $comment_long;\n>  \t\t\tif (defined($comment)) {\n>  \t\t\t\t$comment = chop_str($comment, 30, 5);\n>  \t\t\t}\n\nIs an enhancement.\n\n> @@ -1119,13 +1120,17 @@ sub git_summary {\n>  \t\t\t$alternate ^= 1;\n>  \t\t\tif ($i-- > 0) {\n>  \t\t\t\tprint \"<td><i>$tag{'age'}</i></td>\\n\" .\n> -\t\t\t\t      \"<td>\" .\n> +\t\t\t\t      \"<td>\";\n>  \t\t\t\t      $cgi->a({-href => \"$my_uri?\" . esc_param(\"p=$project;a=$tag{'reftype'};h=$tag{'refid'}\"), -class => \"list\"},\n>  \t\t\t\t      \"<b>\" . esc_html($tag{'name'}) . \"</b>\") .\n>  \t\t\t\t      \"</td>\\n\" .\n>  \t\t\t\t      \"<td>\";\n\nIs a fix.  How could we have missed this?\n\n>  \t\t\t\tif (defined($comment)) {\n> -\t\t\t\t      print $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n> +\t\t\t\t\tif (length($comment) < length($comment_long)) {\n> +\t\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\"), -title => \"$comment_long\"}, $comment);\n> +\t\t\t\t\t} else {\n> +\t\t\t\t\t\tprint $cgi->a({-class => \"list\", -href => \"$my_uri?\" . esc_param(\"p=$project;a=tag;h=$tag{'id'}\")}, $comment);\n> +\t\t\t\t\t}\n>  \t\t\t\t}\n>  \t\t\t\tprint \"</td>\\n\" .\n>  \t\t\t\t      \"<td class=\\\"link\\\">\";\n\nIs an enhancement -- I suspect it is not worth to switch\ndepending on the length of $comment_long.  Does it clutter the\noutput too much if you did -title to everybody?\n\n> @@ -1346,7 +1351,8 @@ sub git_tags {\n>  \t\tforeach my $entry (@$taglist) {\n>  \t\t\tmy %tag = %$entry;\n>  \t\t\tmy $comment_lines = $tag{'comment'};\n> -\t\t\tmy $comment = shift @$comment_lines;\n> +\t\t\tmy $comment_long = shift @$comment_lines;\n> +\t\t\tmy $comment = $comment_long;\n>  \t\t\tif (defined($comment)) {\n>  \t\t\t\t$comment = chop_str($comment, 30, 5);\n>  \t\t\t}\n\nIs an enhancement.  I think the matching hunk to fix the same\n\"$cgi->a() output concatenated as print argument\" problem is\nmissing here.  And the next hunk the same comment as the one for\ngit_summary applies.\n\nAnd as you say, git_summary and git_tags do look similar.  Maybe\nwe would want to refactor them first to clean things up before\npiling up more features?\n"},{"id":"22236","messageId":"e7deqs$vso$1@sea.gmane.org","threadId":"4606","inReplyTo":"7vu06exfym.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Add title attribute with full first line of tag comment if it is needed","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-06-22T06:54:32Z","receivedAt":"2006-06-22T06:54:32Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> For commits in oneline view (summary, shortlog, history) commit title\n>> (first line of commit message) is link to commit itself. If commit title\n>> (commit description) is shortened in output, hyperlink has title attribute\n>> with full title.\n> \n> There are pure fixes and this \"-title\" enhancement intermixed.\n> Can we have fixes-only first?\n\nO.K. done.\n\n> And as you say, git_summary and git_tags do look similar.  Maybe\n> we would want to refactor them first to clean things up before\n> piling up more features?\n \nO.K. will do.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}