{"thread":{"id":"2428","subject":"git and cogito update, gitweb problem","startedAt":"2005-11-10T12:02:01Z","lastAt":"2005-11-17T17:11:12Z","messageCount":4,"participants":["Nico -telmich- Schottelius","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"11472","messageId":"20051110120201.GE22064@schottelius.org","threadId":"2428","inReplyTo":null,"subject":"git and cogito update, gitweb problem","fromName":"Nico -telmich- Schottelius","fromEmail":"nico-linux-git@schottelius.org","sentAt":"2005-11-10T12:02:01Z","receivedAt":"2005-11-10T12:02:01Z","isPatch":false,"sender":{"key":"nico-linux-git@schottelius.org","avatar":null},"body":"Hello again!\n\nI just wanted to present you an automatic git and cogito updating script,\nbut I've still the problem with '+' in filenames in gitweb [0].\nIf somebody tells me what would be the finest / best way to fix that\nin gitweb (i am not that perl guru) I'll fix it myself.\n\nSo currently I copied the script temporarily to [1].\n\nI use it to install the latest git and cogito automatically.\n\nPlease comment / critize.\n\nNico\n\n\n[0]: http://linux.schottelius.org/cgi-bin/gitweb.cgi?p=cLinux/dev-scripts.git;a=blob;h=86f24af137034bb44bc3ce866cd6b20d8ea5ff94;hb=a1ad5cd34497c0cd870c138039eda15dd6fea02f;f=update-git+cogito.sh\n[1]: http://creme.schottelius.org/~nico/temp/update-git+cogito.sh\n\n-- \nLatest project: cinit-0.2.1 (http://linux.schottelius.org/cinit/)\nOpen Source nutures open minds and free, creative developers.\n"},{"id":"11487","messageId":"7vvez0z8yj.fsf@assigned-by-dhcp.cox.net","threadId":"2428","inReplyTo":"20051110120201.GE22064@schottelius.org","subject":"Re: git and cogito update, gitweb problem","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-10T17:52:36Z","receivedAt":"2005-11-10T17:52:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nico -telmich- Schottelius <nico-linux-git@schottelius.org> writes:\n\n> I just wanted to present you an automatic git and cogito updating script,\n> but I've still the problem with '+' in filenames in gitweb [0].\n\nProject names (and perhaps tag names) could contain characters\nthat need to be URL escaped as well.\n\nI think this minimally should fix it for the list of files on\nthe commit page (a=commit) but I see the same problem in other\npages everywhere.\n\n---\n\ndiff --git a/gitweb.cgi b/gitweb.cgi\nindex b8f1537..7b05fe2 100755\n--- a/gitweb.cgi\n+++ b/gitweb.cgi\n@@ -10,7 +10,7 @@\n use strict;\n use warnings;\n use CGI qw(:standard :escapeHTML -nosticky);\n-use CGI::Util qw(unescape);\n+use CGI::Util qw(unescape escape);\n use CGI::Carp qw(fatalsToBrowser);\n use Fcntl ':mode';\n \n@@ -1393,7 +1395,7 @@ sub git_tree {\n \t\tmy $t_type = $2;\n \t\tmy $t_hash = $3;\n \t\tmy $t_name = $4;\n-\t\t$file_key = \";f=$base$t_name\";\n+\t\t$file_key = \";f=\" . escape(\"$base$t_name\");\n \t\tif ($alternate) {\n \t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n \t\t} else {\n@@ -1628,23 +1630,26 @@ sub git_commit {\n \t\t$expires = \"+1d\";\n \t}\n \tgit_header_html(undef, $expires);\n+\n+\tmy $eproject = escape($project);\n+\n \tprint \"<div class=\\\"page_nav\\\">\\n\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=summary\"}, \"summary\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=shortlog;h=$hash\"}, \"shortlog\") .\n-\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=log;h=$hash\"}, \"log\") .\n+\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=summary\"}, \"summary\") .\n+\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=shortlog;h=$hash\"}, \"shortlog\") .\n+\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=log;h=$hash\"}, \"log\") .\n \t      \" | commit\";\n \tif (defined $co{'parent'}) {\n-\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\"}, \"commitdiff\");\n+\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=commitdiff;h=$hash\"}, \"commitdiff\");\n \t}\n-\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") . \"\\n\" .\n+\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") . \"\\n\" .\n \t      \"<br/><br/></div>\\n\";\n \tif (defined $co{'parent'}) {\n \t\tprint \"<div>\\n\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n+\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=commitdiff;h=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t\t      \"</div>\\n\";\n \t} else {\n \t\tprint \"<div>\\n\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n+\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=tree;h=$co{'tree'};hb=$hash\", -class => \"title\"}, escapeHTML($co{'title'})) . \"\\n\" .\n \t\t      \"</div>\\n\";\n \t}\n \tprint \"<div class=\\\"title_text\\\">\\n\" .\n@@ -1665,19 +1670,19 @@ sub git_commit {\n \tprint \"<tr>\" .\n \t      \"<td>tree</td>\" .\n \t      \"<td style=\\\"font-family:monospace\\\">\" .\n-\t      $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\", class => \"list\"}, $co{'tree'}) .\n+\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=tree;h=$co{'tree'};hb=$hash\", class => \"list\"}, $co{'tree'}) .\n \t      \"</td>\" .\n-\t      \"<td class=\\\"link\\\">\" . $cgi->a({-href => \"$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") .\n+\t      \"<td class=\\\"link\\\">\" . $cgi->a({-href => \"$my_uri?p=$eproject;a=tree;h=$co{'tree'};hb=$hash\"}, \"tree\") .\n \t      \"</td>\" .\n \t      \"</tr>\\n\";\n \tmy $parents  = $co{'parents'};\n \tforeach my $par (@$parents) {\n \t\tprint \"<tr>\" .\n \t\t      \"<td>parent</td>\" .\n-\t\t      \"<td style=\\\"font-family:monospace\\\">\" . $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$par\", class => \"list\"}, $par) . \"</td>\" .\n+\t\t      \"<td style=\\\"font-family:monospace\\\">\" . $cgi->a({-href => \"$my_uri?p=$eproject;a=commit;h=$par\", class => \"list\"}, $par) . \"</td>\" .\n \t\t      \"<td class=\\\"link\\\">\" .\n-\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=commit;h=$par\"}, \"commit\") .\n-\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=commitdiff;h=$hash;hp=$par\"}, \"commitdiff\") .\n+\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=commit;h=$par\"}, \"commit\") .\n+\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=commitdiff;h=$hash;hp=$par\"}, \"commitdiff\") .\n \t\t      \"</td>\" .\n \t\t      \"</tr>\\n\";\n \t}\n@@ -1726,6 +1731,7 @@ sub git_commit {\n \t\tmy $status = $5;\n \t\tmy $similarity = $6;\n \t\tmy $file = $7;\n+\t\tmy $efile = escape($file);\n \t\tif ($alternate) {\n \t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n \t\t} else {\n@@ -1738,16 +1744,16 @@ sub git_commit {\n \t\t\t\t$mode_chng = sprintf(\" with mode: %04o\", (oct $to_mode) & 0777);\n \t\t\t}\n \t\t\tprint \"<td>\" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file\", -class => \"list\"}, escapeHTML($file)) . \"</td>\\n\" .\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$efile\", -class => \"list\"}, escapeHTML($file)) . \"</td>\\n\" .\n \t\t\t      \"<td><span style=\\\"color: #008000;\\\">[new \" . file_type($to_mode) . \"$mode_chng]</span></td>\\n\" .\n-\t\t\t      \"<td class=\\\"link\\\">\" . $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file\"}, \"blob\") . \"</td>\\n\";\n+\t\t\t      \"<td class=\\\"link\\\">\" . $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$efile\"}, \"blob\") . \"</td>\\n\";\n \t\t} elsif ($status eq \"D\") {\n \t\t\tprint \"<td>\" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file\", -class => \"list\"}, escapeHTML($file)) . \"</td>\\n\" .\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$from_id;hb=$hash;f=$efile\", -class => \"list\"}, escapeHTML($file)) . \"</td>\\n\" .\n \t\t\t      \"<td><span style=\\\"color: #c00000;\\\">[deleted \" . file_type($from_mode). \"]</span></td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$file\"}, \"blob\") .\n-\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=history;h=$hash;f=$file\"}, \"history\") .\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$from_id;hb=$hash;f=$efile\"}, \"blob\") .\n+\t\t\t      \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=history;h=$hash;f=$efile\"}, \"history\") .\n \t\t\t      \"</td>\\n\"\n \t\t} elsif ($status eq \"M\" || $status eq \"T\") {\n \t\t\tmy $mode_chnge = \"\";\n@@ -1767,18 +1773,18 @@ sub git_commit {\n \t\t\t}\n \t\t\tprint \"<td>\";\n \t\t\tif ($to_id ne $from_id) {\n-\t\t\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file\", -class => \"list\"}, escapeHTML($file));\n+\t\t\t\tprint $cgi->a({-href => \"$my_uri?p=$eproject;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$efile\", -class => \"list\"}, escapeHTML($file));\n \t\t\t} else {\n-\t\t\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file\", -class => \"list\"}, escapeHTML($file));\n+\t\t\t\tprint $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$efile\", -class => \"list\"}, escapeHTML($file));\n \t\t\t}\n \t\t\tprint \"</td>\\n\" .\n \t\t\t      \"<td>$mode_chnge</td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\";\n-\t\t\tprint $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$file\"}, \"blob\");\n+\t\t\tprint $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$efile\"}, \"blob\");\n \t\t\tif ($to_id ne $from_id) {\n-\t\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file\"}, \"diff\");\n+\t\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$efile\"}, \"diff\");\n \t\t\t}\n-\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=history;h=$hash;f=$file\"}, \"history\") . \"\\n\";\n+\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=history;h=$hash;f=$efile\"}, \"history\") . \"\\n\";\n \t\t\tprint \"</td>\\n\";\n \t\t} elsif ($status eq \"R\") {\n \t\t\tmy ($from_file, $to_file) = split \"\\t\", $file;\n@@ -1787,14 +1793,14 @@ sub git_commit {\n \t\t\t\t$mode_chng = sprintf(\", mode: %04o\", (oct $to_mode) & 0777);\n \t\t\t}\n \t\t\tprint \"<td>\" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file\", -class => \"list\"}, escapeHTML($to_file)) . \"</td>\\n\" .\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$to_file\", -class => \"list\"}, escapeHTML($to_file)) . \"</td>\\n\" .\n \t\t\t      \"<td><span style=\\\"color: #777777;\\\">[moved from \" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$from_id;hb=$hash;f=$from_file\", -class => \"list\"}, escapeHTML($from_file)) .\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$from_id;hb=$hash;f=$from_file\", -class => \"list\"}, escapeHTML($from_file)) .\n \t\t\t      \" with \" . (int $similarity) . \"% similarity$mode_chng]</span></td>\\n\" .\n \t\t\t      \"<td class=\\\"link\\\">\" .\n-\t\t\t      $cgi->a({-href => \"$my_uri?p=$project;a=blob;h=$to_id;hb=$hash;f=$to_file\"}, \"blob\");\n+\t\t\t      $cgi->a({-href => \"$my_uri?p=$eproject;a=blob;h=$to_id;hb=$hash;f=$to_file\"}, \"blob\");\n \t\t\tif ($to_id ne $from_id) {\n-\t\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file\"}, \"diff\");\n+\t\t\t\tprint \" | \" . $cgi->a({-href => \"$my_uri?p=$eproject;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$to_file\"}, \"diff\");\n \t\t\t}\n \t\t\tprint \"</td>\\n\";\n \t\t}\n"},{"id":"12105","messageId":"20051117142324.GD16963@schottelius.org","threadId":"2428","inReplyTo":"7vvez0z8yj.fsf@assigned-by-dhcp.cox.net","subject":"Re: git and cogito update, gitweb problem","fromName":"Nico -telmich- Schottelius","fromEmail":"nico-linux-git@schottelius.org","sentAt":"2005-11-17T14:23:24Z","receivedAt":"2005-11-17T14:23:24Z","isPatch":false,"sender":{"key":"nico-linux-git@schottelius.org","avatar":null},"body":"Junio C Hamano [Thu, Nov 10, 2005 at 09:52:36AM -0800]:\n> [...]\n> I think this minimally should fix it [...]\n\nWill try that the next days!\n\nNico\n"},{"id":"12126","messageId":"7vfypvw66n.fsf@assigned-by-dhcp.cox.net","threadId":"2428","inReplyTo":"20051117142324.GD16963@schottelius.org","subject":"Re: git and cogito update, gitweb problem","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-17T17:11:12Z","receivedAt":"2005-11-17T17:11:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nico -telmich- Schottelius <nico-linux-git@schottelius.org> writes:\n\n> Junio C Hamano [Thu, Nov 10, 2005 at 09:52:36AM -0800]:\n>> [...]\n>> I think this minimally should fix it [...]\n>\n> Will try that the next days!\n\nI think gitweb upstream has independently dealing with it in its\nrecent updates.\n"}]}