{"thread":{"id":"21205","subject":"[RFC/PATCH] gitweb: linkify author/committer names with search","startedAt":"2009-10-12T06:19:00Z","lastAt":"2009-10-13T20:16:03Z","messageCount":7,"participants":["Stephen Boyd","Junio C Hamano","Giuseppe Bilotta"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"124671","messageId":"1255328340-28449-1-git-send-email-bebarino@gmail.com","threadId":"21205","inReplyTo":null,"subject":"[RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-12T06:19:00Z","receivedAt":"2009-10-12T06:19:00Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"It's nice to search for an author by merely clicking on their name in\ngitweb. This is usually faster than selecting the name, copying the\nselection, pasting it into the search box, selecting between\nauthor/committer and then hitting enter.\n\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nCc'ed Jakub as he seems to be resident gitweb expert. \n\nI thought this might be a nice addition.\n\nThe problem is I can't get it to work with UTF-8 characters. I'm not sure\nif it's my system or not, so I'm just posting here to see if others\nexperience the same problem and if there's interest.\n\n gitweb/gitweb.perl |   18 ++++++++++++++----\n 1 files changed, 14 insertions(+), 4 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 24b2193..349e734 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1604,7 +1604,10 @@ sub format_author_html {\n \tmy $author = chop_and_escape_str($co->{'author_name'}, @_);\n \treturn \"<$tag class=\\\"author\\\">\" .\n \t       git_get_avatar($co->{'author_email'}, -pad_after => 1) .\n-\t       $author . \"</$tag>\";\n+\t       $cgi->a({-href => href(action=>\"search\", hash=>$hash,\n+\t\t\tsearchtext=>$co->{'author_name'},\n+\t\t\tsearchtype=>\"author\"), class=>\"list\"}, $author) .\n+\t       \"</$tag>\";\n }\n \n # format git diff header line, i.e. \"diff --(git|combined|cc) ...\"\n@@ -3373,10 +3376,13 @@ sub git_print_authorship {\n \tmy $co = shift;\n \tmy %opts = @_;\n \tmy $tag = $opts{-tag} || 'div';\n+\tmy $author = $co->{'author_name'};\n \n \tmy %ad = parse_date($co->{'author_epoch'}, $co->{'author_tz'});\n \tprint \"<$tag class=\\\"author_date\\\">\" .\n-\t      esc_html($co->{'author_name'}) .\n+\t      $cgi->a({-href => href(action=>\"search\", searchtext=>$author,\n+\t\t      searchtype=>\"author\"), class=>\"list\"},\n+\t\t      esc_html($author)) .\n \t      \" [$ad{'rfc2822'}\";\n \tprint_local_time(%ad) if ($opts{-localtime});\n \tprint \"]\" . git_get_avatar($co->{'author_email'}, -pad_before => 1)\n@@ -3395,8 +3401,12 @@ sub git_print_authorship_rows {\n \t@people = ('author', 'committer') unless @people;\n \tforeach my $who (@people) {\n \t\tmy %wd = parse_date($co->{\"${who}_epoch\"}, $co->{\"${who}_tz\"});\n-\t\tprint \"<tr><td>$who</td><td>\" . esc_html($co->{$who}) . \"</td>\" .\n-\t\t      \"<td rowspan=\\\"2\\\">\" .\n+\t\tprint \"<tr><td>$who</td><td>\" .\n+\t\t      $cgi->a({-href => href(action=>\"search\",\n+\t\t\t       searchtext=>$co->{\"${who}_name\"},\n+\t\t\t       searchtype=>$who), class=>\"list\"},\n+\t\t\t       esc_html($co->{$who})) .\n+\t\t      \"</td><td rowspan=\\\"2\\\">\" .\n \t\t      git_get_avatar($co->{\"${who}_email\"}, -size => 'double') .\n \t\t      \"</td></tr>\\n\" .\n \t\t      \"<tr>\" .\n-- \n1.6.5.1.g53fd\n"},{"id":"124778","messageId":"7vy6ng5gdr.fsf@alter.siamese.dyndns.org","threadId":"21205","inReplyTo":"1255328340-28449-1-git-send-email-bebarino@gmail.com","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-12T23:42:08Z","receivedAt":"2009-10-12T23:42:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Boyd <bebarino@gmail.com> writes:\n\n> It's nice to search for an author by merely clicking on their name in\n> gitweb. This is usually faster than selecting the name, copying the\n> selection, pasting it into the search box, selecting between\n> author/committer and then hitting enter.\n\nThe intent makes sense to me, although I somehow suspect that with avatar\nsupport the user might be tempted to click on the icon not necessarily on\nthe name string.\n\n> Signed-off-by: Stephen Boyd <bebarino@gmail.com>\n> ---\n>\n> Cc'ed Jakub as he seems to be resident gitweb expert. \n>\n> I thought this might be a nice addition.\n>\n> The problem is I can't get it to work with UTF-8 characters. I'm not sure\n> if it's my system or not, so I'm just posting here to see if others\n> experience the same problem and if there's interest.\n>\n>  gitweb/gitweb.perl |   18 ++++++++++++++----\n>  1 files changed, 14 insertions(+), 4 deletions(-)\n>\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 24b2193..349e734 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -1604,7 +1604,10 @@ sub format_author_html {\n>  \tmy $author = chop_and_escape_str($co->{'author_name'}, @_);\n>  \treturn \"<$tag class=\\\"author\\\">\" .\n>  \t       git_get_avatar($co->{'author_email'}, -pad_after => 1) .\n> -\t       $author . \"</$tag>\";\n> +\t       $cgi->a({-href => href(action=>\"search\", hash=>$hash,\n> +\t\t\tsearchtext=>$co->{'author_name'},\n> +\t\t\tsearchtype=>\"author\"), class=>\"list\"}, $author) .\n> +\t       \"</$tag>\";\n>  }\n>  \n>  # format git diff header line, i.e. \"diff --(git|combined|cc) ...\"\n> @@ -3373,10 +3376,13 @@ sub git_print_authorship {\n>  \tmy $co = shift;\n>  \tmy %opts = @_;\n>  \tmy $tag = $opts{-tag} || 'div';\n> +\tmy $author = $co->{'author_name'};\n>  \n>  \tmy %ad = parse_date($co->{'author_epoch'}, $co->{'author_tz'});\n>  \tprint \"<$tag class=\\\"author_date\\\">\" .\n> -\t      esc_html($co->{'author_name'}) .\n> +\t      $cgi->a({-href => href(action=>\"search\", searchtext=>$author,\n> +\t\t      searchtype=>\"author\"), class=>\"list\"},\n> +\t\t      esc_html($author)) .\n>  \t      \" [$ad{'rfc2822'}\";\n>  \tprint_local_time(%ad) if ($opts{-localtime});\n>  \tprint \"]\" . git_get_avatar($co->{'author_email'}, -pad_before => 1)\n> @@ -3395,8 +3401,12 @@ sub git_print_authorship_rows {\n>  \t@people = ('author', 'committer') unless @people;\n>  \tforeach my $who (@people) {\n>  \t\tmy %wd = parse_date($co->{\"${who}_epoch\"}, $co->{\"${who}_tz\"});\n> -\t\tprint \"<tr><td>$who</td><td>\" . esc_html($co->{$who}) . \"</td>\" .\n> -\t\t      \"<td rowspan=\\\"2\\\">\" .\n> +\t\tprint \"<tr><td>$who</td><td>\" .\n> +\t\t      $cgi->a({-href => href(action=>\"search\",\n> +\t\t\t       searchtext=>$co->{\"${who}_name\"},\n> +\t\t\t       searchtype=>$who), class=>\"list\"},\n> +\t\t\t       esc_html($co->{$who})) .\n> +\t\t      \"</td><td rowspan=\\\"2\\\">\" .\n>  \t\t      git_get_avatar($co->{\"${who}_email\"}, -size => 'double') .\n>  \t\t      \"</td></tr>\\n\" .\n>  \t\t      \"<tr>\" .\n> -- \n> 1.6.5.1.g53fd\n"},{"id":"124782","messageId":"4AD3CA78.6090209@gmail.com","threadId":"21205","inReplyTo":"7vy6ng5gdr.fsf@alter.siamese.dyndns.org","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-13T00:31:52Z","receivedAt":"2009-10-13T00:31:52Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Junio C Hamano wrote:\n>\n> The intent makes sense to me, although I somehow suspect that with avatar\n> support the user might be tempted to click on the icon not necessarily on\n> the name string.\n\nOk if the utf8 thing can be solved I'll make sure to linkify the icon too.\n"},{"id":"124837","messageId":"1255429615-4402-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"21205","inReplyTo":"1255328340-28449-1-git-send-email-bebarino@gmail.com","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-10-13T10:26:55Z","receivedAt":"2009-10-13T10:26:55Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Monday 12 October 2009 08:19, Stephen Boyd wrote:\n\n> The problem is I can't get it to work with UTF-8 characters. I'm not sure\n> if it's my system or not, so I'm just posting here to see if others\n> experience the same problem and if there's interest.\n\nDoes it work if you use CGI::escape() on the author names when filling\nthe searchtext?\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"124865","messageId":"4AD4C94A.9010909@gmail.com","threadId":"21205","inReplyTo":"1255429615-4402-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-13T18:39:06Z","receivedAt":"2009-10-13T18:39:06Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"Giuseppe Bilotta wrote:\n> On Monday 12 October 2009 08:19, Stephen Boyd wrote:\n>> The problem is I can't get it to work with UTF-8 characters. I'm not sure\n>> if it's my system or not, so I'm just posting here to see if others\n>> experience the same problem and if there's interest.\n>\n> Does it work if you use CGI::escape() on the author names when filling\n> the searchtext?\n\nThis doesn't seem to work. Now I get %25 in front of the escaped\ncharacters. For example, a space is now %25%20.\n\nCan you reproduce my problem locally?\n"},{"id":"124876","messageId":"cb7bb73a0910131241t7220a3c2q16e99a8fc62dd29a@mail.gmail.com","threadId":"21205","inReplyTo":"4AD4C94A.9010909@gmail.com","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-10-13T19:41:42Z","receivedAt":"2009-10-13T19:41:42Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Tue, Oct 13, 2009 at 8:39 PM, Stephen Boyd <bebarino@gmail.com> wrote:\n> Giuseppe Bilotta wrote:\n>> On Monday 12 October 2009 08:19, Stephen Boyd wrote:\n>>> The problem is I can't get it to work with UTF-8 characters. I'm not sure\n>>> if it's my system or not, so I'm just posting here to see if others\n>>> experience the same problem and if there's interest.\n>>\n>> Does it work if you use CGI::escape() on the author names when filling\n>> the searchtext?\n>\n> This doesn't seem to work. Now I get %25 in front of the escaped\n> characters. For example, a space is now %25%20.\n>\n> Can you reproduce my problem locally?\n\nReproduced, debugged, patch incoming (the problem is not in your patch\nbut in esc_param).\n\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"124886","messageId":"780e0a6b0910131316j58703de4l80da2eca547ae337@mail.gmail.com","threadId":"21205","inReplyTo":"cb7bb73a0910131241t7220a3c2q16e99a8fc62dd29a@mail.gmail.com","subject":"Re: [RFC/PATCH] gitweb: linkify author/committer names with search","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2009-10-13T20:16:03Z","receivedAt":"2009-10-13T20:16:03Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"On Tue, Oct 13, 2009 at 12:41 PM, Giuseppe Bilotta\n<giuseppe.bilotta@gmail.com> wrote:\n>\n> Reproduced, debugged, patch incoming (the problem is not in your patch\n> but in esc_param).\n>\n\nThanks. I will test later today. I think a similar problem affects the\nbranch name labels (the colored boxes with ref names in them) when the\nname has utf8 characters.\n"}]}