{"thread":{"id":"5305","subject":"[PATCH 1/7] gitweb: Add support for per project git URLs","startedAt":"2006-08-17T09:21:21Z","lastAt":"2006-08-17T18:58:53Z","messageCount":12,"participants":["Jakub Narebski","Junio C Hamano","David Rientjes"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"25463","messageId":"11558064883957-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":null,"subject":"[PATCH 0/7] A few gitweb cleanups and improvements","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:21Z","receivedAt":"2006-08-17T09:21:21Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\nA few gitweb cleanups, refactoring, and improvements.\nBased on 'master', 1c2a4f5addce479c619057c6cdc841802139982f\nFirst patch in series was sent earlier.\n\n gitweb/gitweb.perl |   80 ++++++++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 74 insertions(+), 6 deletions(-)\n\nJakub Narebski:\n      gitweb: Add support for per project git URLs\n      gitweb: Refactor printing commit message\n      gitweb: Fix typo in separation of git_difftree_body\n      gitweb: Expand href() function to use key as param name for no mapping\n      gitweb: Added parse_difftree_raw_line function for later use\n      gitweb: Sort query string parameters in href() function\n      gitweb: Uniquify version info output, add meta generator in page header\n\n-- \nJakub Narebski\nPoland\n"},{"id":"25462","messageId":"11558064894129-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 1/7] gitweb: Add support for per project git URLs","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:22Z","receivedAt":"2006-08-17T09:21:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"It is now possible for project to have individual clone/fetch URLs.\nThey are provided in new file 'cloneurl' added below project's\n$GIT_DIR directory.\n\nIf there is no cloneurl file, concatenation of git base URLs with\nproject name is used.\n\nThis is merge of Jakub Narebski and David Rientjes\n  gitweb: Show project's git URL on summary page\nwith Aneesh Kumar\n  gitweb: Add support for cloneurl.\n  gitweb: Support multiple clone urls\npatches.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\nSigned-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n---\n gitweb/gitweb.perl |   20 +++++++++++++++++---\n 1 files changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 37a6284..7c92ac3 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -533,6 +533,16 @@ sub git_get_project_description {\n \treturn $descr;\n }\n \n+sub git_get_project_url_list {\n+\tmy $path = shift;\n+\n+\topen my $fd, \"$projectroot/$path/cloneurl\" or return undef;\n+\tmy @git_project_url_list = map { chomp; $_ } <$fd>;\n+\tclose $fd;\n+\n+\treturn wantarray ? @git_project_url_list : \\@git_project_url_list;\n+}\n+\n sub git_get_projects_list {\n \tmy @list;\n \n@@ -1697,10 +1707,14 @@ sub git_summary {\n \t      \"<tr><td>description</td><td>\" . esc_html($descr) . \"</td></tr>\\n\" .\n \t      \"<tr><td>owner</td><td>$owner</td></tr>\\n\" .\n \t      \"<tr><td>last change</td><td>$cd{'rfc2822'}</td></tr>\\n\";\n+\t# use per project git URL list in $projectroot/$project/cloneurl\n+\t# or make project git URL from git base URL and project name\n \tmy $url_tag = \"URL\";\n-\tforeach my $git_base_url (@git_base_url_list) {\n-\t\tnext unless $git_base_url;\n-\t\tprint \"<tr><td>$url_tag</td><td>$git_base_url/$project</td></tr>\\n\";\n+\tmy @url_list = git_get_project_url_list($project);\n+\t@url_list = map { \"$_/$project\" } @git_base_url_list unless @url_list;\n+\tforeach my $git_url (@url_list) {\n+\t\tnext unless $git_url;\n+\t\tprint \"<tr><td>$url_tag</td><td>$git_url</td></tr>\\n\";\n \t\t$url_tag = \"\";\n \t}\n \tprint \"</table>\\n\";\n-- \n1.4.1.1\n"},{"id":"25469","messageId":"11558064891330-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 2/7] gitweb: Refactor printing commit message","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:23Z","receivedAt":"2006-08-17T09:21:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Separate pretty-printing commit message (comment) into git_print_log\nand git_print_simplified_log subroutines. As of now the former is used\nin git_commit, the latter in git_log and git_commitdiff.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |  132 ++++++++++++++++++++++++++--------------------------\n 1 files changed, 67 insertions(+), 65 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7c92ac3..0d869f2 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1174,6 +1174,66 @@ sub git_print_page_path {\n \t}\n }\n \n+sub git_print_log {\n+\tmy $log = shift;\n+\n+\t# remove leading empty lines\n+\twhile (defined $log->[0] && $log->[0] eq \"\") {\n+\t\tshift @$log;\n+\t}\n+\n+\t# print log\n+\tmy $signoff = 0;\n+\tmy $empty = 0;\n+\tforeach my $line (@$log) {\n+\t\t# print only one empty line\n+\t\t# do not print empty line after signoff\n+\t\tif ($line eq \"\") {\n+\t\t\tnext if ($empty || $signoff);\n+\t\t\t$empty = 1;\n+\t\t} else {\n+\t\t\t$empty = 0;\n+\t\t}\n+\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n+\t\t\t$signoff = 1;\n+\t\t\tprint \"<span class=\\\"signoff\\\">\" . esc_html($line) . \"</span><br/>\\n\";\n+\t\t} else {\n+\t\t\t$signoff = 0;\n+\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n+\t\t}\n+\t}\n+}\n+\n+sub git_print_simplified_log {\n+\tmy $log = shift;\n+\tmy $remove_title = shift;\n+\n+\tshift @$log if $remove_title;\n+\t# remove leading empty lines\n+\twhile (defined $log->[0] && $log->[0] eq \"\") {\n+\t\tshift @$log;\n+\t}\n+\n+\t# simplify and print log\n+\tmy $empty = 0;\n+\tforeach my $line (@$log) {\n+\t\t# remove signoff lines\n+\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n+\t\t\tnext;\n+\t\t}\n+\t\t# print only one empty line\n+\t\tif ($line eq \"\") {\n+\t\t\tnext if $empty;\n+\t\t\t$empty = 1;\n+\t\t} else {\n+\t\t\t$empty = 0;\n+\t\t}\n+\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n+\t}\n+\t# end with single empty line\n+\tprint \"<br/>\\n\" unless $empty;\n+}\n+\n ## ......................................................................\n ## functions printing large fragments of HTML\n \n@@ -2155,27 +2215,10 @@ sub git_log {\n \t\t      \"<br/>\\n\" .\n \t\t      \"</div>\\n\" .\n \t\t      \"<i>\" . esc_html($co{'author_name'}) .  \" [$ad{'rfc2822'}]</i><br/>\\n\" .\n-\t\t      \"</div>\\n\" .\n-\t\t      \"<div class=\\\"log_body\\\">\\n\";\n-\t\tmy $comment = $co{'comment'};\n-\t\tmy $empty = 0;\n-\t\tforeach my $line (@$comment) {\n-\t\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\tif ($line eq \"\") {\n-\t\t\t\tif ($empty) {\n-\t\t\t\t\tnext;\n-\t\t\t\t}\n-\t\t\t\t$empty = 1;\n-\t\t\t} else {\n-\t\t\t\t$empty = 0;\n-\t\t\t}\n-\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n-\t\t}\n-\t\tif (!$empty) {\n-\t\t\tprint \"<br/>\\n\";\n-\t\t}\n+\t\t      \"</div>\\n\";\n+\n+\t\tprint \"<div class=\\\"log_body\\\">\\n\";\n+\t\tgit_print_simplified_log($co{'comment'});\n \t\tprint \"</div>\\n\";\n \t}\n \tgit_footer_html();\n@@ -2256,28 +2299,9 @@ sub git_commit {\n \t}\n \tprint \"</table>\".\n \t      \"</div>\\n\";\n+\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n-\tmy $comment = $co{'comment'};\n-\tmy $empty = 0;\n-\tmy $signed = 0;\n-\tforeach my $line (@$comment) {\n-\t\t# print only one empty line\n-\t\tif ($line eq \"\") {\n-\t\t\tif ($empty || $signed) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\t$empty = 1;\n-\t\t} else {\n-\t\t\t$empty = 0;\n-\t\t}\n-\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n-\t\t\t$signed = 1;\n-\t\t\tprint \"<span class=\\\"signoff\\\">\" . esc_html($line) . \"</span><br/>\\n\";\n-\t\t} else {\n-\t\t\t$signed = 0;\n-\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n-\t\t}\n-\t}\n+\tgit_print_log($co{'comment'});\n \tprint \"</div>\\n\";\n \n \tgit_difftree_body(\\@difftree, $parent);\n@@ -2343,29 +2367,7 @@ sub git_commitdiff {\n \tgit_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);\n \tgit_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n-\tmy $comment = $co{'comment'};\n-\tmy $empty = 0;\n-\tmy $signed = 0;\n-\tmy @log = @$comment;\n-\t# remove first and empty lines after that\n-\tshift @log;\n-\twhile (defined $log[0] && $log[0] eq \"\") {\n-\t\tshift @log;\n-\t}\n-\tforeach my $line (@log) {\n-\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n-\t\t\tnext;\n-\t\t}\n-\t\tif ($line eq \"\") {\n-\t\t\tif ($empty) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\t$empty = 1;\n-\t\t} else {\n-\t\t\t$empty = 0;\n-\t\t}\n-\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n-\t}\n+\tgit_print_simplified_log($co{'comment'}, 1); # skip title\n \tprint \"<br/>\\n\";\n \tforeach my $line (@difftree) {\n \t\t# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'\n-- \n1.4.1.1\n"},{"id":"25468","messageId":"1155806489378-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 3/7] gitweb: Fix typo in separation of git_difftree_body","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:24Z","receivedAt":"2006-08-17T09:21:24Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0d869f2..86266da 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1322,7 +1322,7 @@ sub git_difftree_body {\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t\t$cgi->a({-href => href(action=>\"blob\", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, \"blob\");\n \t\t\tif ($to_id ne $from_id) { # modified\n-\t\t\t\tprint $cgi->a({-href => href(action=>\"blobdiff\", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, \"diff\");\n+\t\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"blobdiff\", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, \"diff\");\n \t\t\t}\n \t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"history\", hash_base=>$hash, file_name=>$file)}, \"history\") . \"\\n\";\n \t\t\tprint \"</td>\\n\";\n-- \n1.4.1.1\n"},{"id":"25467","messageId":"11558064893139-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 4/7] gitweb: Expand href() function to use key as param name for no mapping","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:25Z","receivedAt":"2006-08-17T09:21:25Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Expand href() function to use key name of params hash as a query param\nname, if there is no mapping for given key name.\n\nIt is now safer to use href(); no errors, but links might not work\ncorrectly if caller didn't provide correct arguments.\n\nFuture proofing.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |  143 +++++++++++++++++++++++++++-------------------------\n 1 files changed, 73 insertions(+), 70 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 86266da..d37e7f1 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -204,8 +204,13 @@ sub href(%) {\n \n \tmy $href = \"$my_uri?\";\n \t$href .= esc_param( join(\";\",\n-\t\tmap { \"$mapping{$_}=$params{$_}\" } keys %params\n-\t) );\n+\t\tmap {\n+\t\t\tif (exists $mapping{$_}) {\n+\t\t\t\t\"$mapping{$_}=$params{$_}\";\n+\t\t\t} else {\n+\t\t\t\t\"$_=$params{$_}\";\n+\t\t\t}\n+\t\t} keys %params ) );\n \n \treturn $href;\n }\n@@ -1174,66 +1179,6 @@ sub git_print_page_path {\n \t}\n }\n \n-sub git_print_log {\n-\tmy $log = shift;\n-\n-\t# remove leading empty lines\n-\twhile (defined $log->[0] && $log->[0] eq \"\") {\n-\t\tshift @$log;\n-\t}\n-\n-\t# print log\n-\tmy $signoff = 0;\n-\tmy $empty = 0;\n-\tforeach my $line (@$log) {\n-\t\t# print only one empty line\n-\t\t# do not print empty line after signoff\n-\t\tif ($line eq \"\") {\n-\t\t\tnext if ($empty || $signoff);\n-\t\t\t$empty = 1;\n-\t\t} else {\n-\t\t\t$empty = 0;\n-\t\t}\n-\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n-\t\t\t$signoff = 1;\n-\t\t\tprint \"<span class=\\\"signoff\\\">\" . esc_html($line) . \"</span><br/>\\n\";\n-\t\t} else {\n-\t\t\t$signoff = 0;\n-\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n-\t\t}\n-\t}\n-}\n-\n-sub git_print_simplified_log {\n-\tmy $log = shift;\n-\tmy $remove_title = shift;\n-\n-\tshift @$log if $remove_title;\n-\t# remove leading empty lines\n-\twhile (defined $log->[0] && $log->[0] eq \"\") {\n-\t\tshift @$log;\n-\t}\n-\n-\t# simplify and print log\n-\tmy $empty = 0;\n-\tforeach my $line (@$log) {\n-\t\t# remove signoff lines\n-\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n-\t\t\tnext;\n-\t\t}\n-\t\t# print only one empty line\n-\t\tif ($line eq \"\") {\n-\t\t\tnext if $empty;\n-\t\t\t$empty = 1;\n-\t\t} else {\n-\t\t\t$empty = 0;\n-\t\t}\n-\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n-\t}\n-\t# end with single empty line\n-\tprint \"<br/>\\n\" unless $empty;\n-}\n-\n ## ......................................................................\n ## functions printing large fragments of HTML\n \n@@ -1322,7 +1267,7 @@ sub git_difftree_body {\n \t\t\t      \"<td class=\\\"link\\\">\" .\n \t\t\t\t$cgi->a({-href => href(action=>\"blob\", hash=>$to_id, hash_base=>$hash, file_name=>$file)}, \"blob\");\n \t\t\tif ($to_id ne $from_id) { # modified\n-\t\t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"blobdiff\", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, \"diff\");\n+\t\t\t\tprint $cgi->a({-href => href(action=>\"blobdiff\", hash=>$to_id, hash_parent=>$from_id, hash_base=>$hash, file_name=>$file)}, \"diff\");\n \t\t\t}\n \t\t\tprint \" | \" . $cgi->a({-href => href(action=>\"history\", hash_base=>$hash, file_name=>$file)}, \"history\") . \"\\n\";\n \t\t\tprint \"</td>\\n\";\n@@ -2215,10 +2160,27 @@ sub git_log {\n \t\t      \"<br/>\\n\" .\n \t\t      \"</div>\\n\" .\n \t\t      \"<i>\" . esc_html($co{'author_name'}) .  \" [$ad{'rfc2822'}]</i><br/>\\n\" .\n-\t\t      \"</div>\\n\";\n-\n-\t\tprint \"<div class=\\\"log_body\\\">\\n\";\n-\t\tgit_print_simplified_log($co{'comment'});\n+\t\t      \"</div>\\n\" .\n+\t\t      \"<div class=\\\"log_body\\\">\\n\";\n+\t\tmy $comment = $co{'comment'};\n+\t\tmy $empty = 0;\n+\t\tforeach my $line (@$comment) {\n+\t\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n+\t\t\t\tnext;\n+\t\t\t}\n+\t\t\tif ($line eq \"\") {\n+\t\t\t\tif ($empty) {\n+\t\t\t\t\tnext;\n+\t\t\t\t}\n+\t\t\t\t$empty = 1;\n+\t\t\t} else {\n+\t\t\t\t$empty = 0;\n+\t\t\t}\n+\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n+\t\t}\n+\t\tif (!$empty) {\n+\t\t\tprint \"<br/>\\n\";\n+\t\t}\n \t\tprint \"</div>\\n\";\n \t}\n \tgit_footer_html();\n@@ -2299,9 +2261,28 @@ sub git_commit {\n \t}\n \tprint \"</table>\".\n \t      \"</div>\\n\";\n-\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n-\tgit_print_log($co{'comment'});\n+\tmy $comment = $co{'comment'};\n+\tmy $empty = 0;\n+\tmy $signed = 0;\n+\tforeach my $line (@$comment) {\n+\t\t# print only one empty line\n+\t\tif ($line eq \"\") {\n+\t\t\tif ($empty || $signed) {\n+\t\t\t\tnext;\n+\t\t\t}\n+\t\t\t$empty = 1;\n+\t\t} else {\n+\t\t\t$empty = 0;\n+\t\t}\n+\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n+\t\t\t$signed = 1;\n+\t\t\tprint \"<span class=\\\"signoff\\\">\" . esc_html($line) . \"</span><br/>\\n\";\n+\t\t} else {\n+\t\t\t$signed = 0;\n+\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n+\t\t}\n+\t}\n \tprint \"</div>\\n\";\n \n \tgit_difftree_body(\\@difftree, $parent);\n@@ -2367,7 +2348,29 @@ sub git_commitdiff {\n \tgit_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);\n \tgit_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash);\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n-\tgit_print_simplified_log($co{'comment'}, 1); # skip title\n+\tmy $comment = $co{'comment'};\n+\tmy $empty = 0;\n+\tmy $signed = 0;\n+\tmy @log = @$comment;\n+\t# remove first and empty lines after that\n+\tshift @log;\n+\twhile (defined $log[0] && $log[0] eq \"\") {\n+\t\tshift @log;\n+\t}\n+\tforeach my $line (@log) {\n+\t\tif ($line =~ m/^ *(signed[ \\-]off[ \\-]by[ :]|acked[ \\-]by[ :]|cc[ :])/i) {\n+\t\t\tnext;\n+\t\t}\n+\t\tif ($line eq \"\") {\n+\t\t\tif ($empty) {\n+\t\t\t\tnext;\n+\t\t\t}\n+\t\t\t$empty = 1;\n+\t\t} else {\n+\t\t\t$empty = 0;\n+\t\t}\n+\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n+\t}\n \tprint \"<br/>\\n\";\n \tforeach my $line (@difftree) {\n \t\t# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'\n-- \n1.4.1.1\n"},{"id":"25465","messageId":"11558064893592-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 5/7] gitweb: Added parse_difftree_raw_line function for later use","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:26Z","receivedAt":"2006-08-17T09:21:26Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Adds parse_difftree_raw_line function which parses one line of \"raw\"\nformat diff-tree output into a hash.\n\nFor later use in git_difftree_body, git_commitdiff and\ngit_commitdiff_plain, git_search.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   27 +++++++++++++++++++++++++++\n 1 files changed, 27 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d37e7f1..b3f38bf 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -851,6 +851,33 @@ sub parse_ref {\n \treturn %ref_item;\n }\n \n+sub parse_difftree_raw_line {\n+\tmy $line = shift;\n+\tmy %res;\n+\n+\t# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M\tls-files.c'\n+\t# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M\trev-tree.c'\n+\tif ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\\t(.*)$/) {\n+\t\t$res{'from_mode'} = $1;\n+\t\t$res{'to_mode'} = $2;\n+\t\t$res{'from_id'} = $3;\n+\t\t$res{'to_id'} = $4;\n+\t\t$res{'status'} = $5;\n+\t\t$res{'similarity'} = $6;\n+\t\tif ($res{'status'} eq 'R' || $res{'status'} eq 'C') { # renamed or copied\n+\t\t\t($res{'from_file'}, $res{'to_file'}) = map(unquote, split(\"\\t\", $7));\n+\t\t} else {\n+\t\t\t$res{'file'} = unquote($7);\n+\t\t}\n+\t}\n+\t# 'c512b523472485aef4fff9e57b229d9d243c967f'\n+\t#elsif ($line =~ m/^([0-9a-fA-F]{40})$/) {\n+\t#\t$res{'commit'} = $1;\n+\t#}\n+\n+\treturn wantarray ? %res : \\%res;\n+}\n+\n ## ......................................................................\n ## parse to array of hashes functions\n \n-- \n1.4.1.1\n"},{"id":"25464","messageId":"1155806489764-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 6/7] gitweb: Sort query string parameters in href() function","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:27Z","receivedAt":"2006-08-17T09:21:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Introduction of a href() function to generate an URL for the CGI,\nwhile making it easier to change the encoding of actions into URLs,\nchanged also the ordering of parameters in query string, and in URL.\n\nThis patch tries to bring back old ordering of query string\nparameters. Probably it is not worth the cost; this is an RFC.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   23 ++++++++++++++++++++++-\n 1 files changed, 22 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b3f38bf..d132aab 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -197,8 +197,29 @@ sub href(%) {\n \t\thash_base => \"hb\",\n \t\tpage => \"pg\",\n \t\tsearchtext => \"s\",\n+\t\torder => \"o\",\n \t);\n \n+\tmy %ordering = (\n+\t\tproject => 0,\n+\t\taction => 1,\n+\t\torder => 2,\n+\t\thash => 10,\n+\t\thash_parent => 11,\n+\t\thash_base => 12,\n+\t\tpage => 20,\n+\t\tfile_name => 21,\n+\t\tsearchtext => 22,\n+\t);\n+\n+\tsub byordering ($$) {\n+\t\tif (exists $ordering{$_[0]} && exists $ordering{$_[1]}) {\n+\t\t\treturn $ordering{$_[0]} <=> $ordering{$_[1]};\n+\t\t} else {\n+\t\t\treturn $_[0] cmp $_[1];\n+\t\t}\n+\t}\n+\n \tmy %params = @_;\n \t$params{\"project\"} ||= $project;\n \n@@ -210,7 +231,7 @@ sub href(%) {\n \t\t\t} else {\n \t\t\t\t\"$_=$params{$_}\";\n \t\t\t}\n-\t\t} keys %params ) );\n+\t\t} sort byordering keys %params ) );\n \n \treturn $href;\n }\n-- \n1.4.1.1\n"},{"id":"25466","messageId":"11558064901150-git-send-email-jnareb@gmail.com","threadId":"5305","inReplyTo":"11558064883957-git-send-email-jnareb@gmail.com","subject":"[PATCH 7/7] gitweb: Uniquify version info output, add meta generator in page header","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T09:21:28Z","receivedAt":"2006-08-17T09:21:28Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d132aab..5467880 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1049,10 +1049,11 @@ sub git_header_html {\n <?xml version=\"1.0\" encoding=\"utf-8\"?>\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\">\n-<!-- git web interface v$version, (C) 2005-2006, Kay Sievers <kay.sievers\\@vrfy.org>, Christian Gierke -->\n+<!-- git web interface version $version, (C) 2005-2006, Kay Sievers <kay.sievers\\@vrfy.org>, Christian Gierke -->\n <!-- git core binaries version $git_version -->\n <head>\n <meta http-equiv=\"content-type\" content=\"$content_type; charset=utf-8\"/>\n+<meta name=\"generator\" content=\"gitweb/$version git/$git_version\"/>\n <meta name=\"robots\" content=\"index, nofollow\"/>\n <title>$title</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"$stylesheet\"/>\n-- \n1.4.1.1\n"},{"id":"25476","messageId":"7vfyfvsn2w.fsf@assigned-by-dhcp.cox.net","threadId":"5305","inReplyTo":"11558064893592-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 5/7] gitweb: Added parse_difftree_raw_line function for later use","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-17T09:55:51Z","receivedAt":"2006-08-17T09:55:51Z","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> +sub parse_difftree_raw_line {\n> +\tmy $line = shift;\n> +\tmy %res;\n> +\n> +\t# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M\tls-files.c'\n> +\t# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M\trev-tree.c'\n> +\tif ($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\\t(.*)$/) {\n\nWe would probably want to say that status symbol is an uppercase\nalpha [A-Z].  Or maybe limit it to a non-whitespace letter (\\S).\nDot there to say \"just any letter\" looks wrong.\n\nI would use \"+\" instead of hardcoding the length of mode strings\n(you have 6 there) and object name hash (ditto 40) but that is\nmostly style and a slight future proofing against us using\nlonger hashes (not in our immediate future though).\n"},{"id":"25477","messageId":"7v8xlnsmyl.fsf@assigned-by-dhcp.cox.net","threadId":"5305","inReplyTo":"11558064893139-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 4/7] gitweb: Expand href() function to use key as param name for no mapping","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-17T09:58:26Z","receivedAt":"2006-08-17T09:58:26Z","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> Expand href() function to use key name of params hash as a query param\n> name, if there is no mapping for given key name.\n>\n> It is now safer to use href(); no errors, but links might not work\n> correctly if caller didn't provide correct arguments.\n>\n> Future proofing.\n\nI think that is not a \"future proofing\" but is \"sweeping mess\nunder the rug\" ;-). \n\n> @@ -1174,66 +1179,6 @@ sub git_print_page_path {\n>  \t}\n>  }\n>  \n> -sub git_print_log {\n> -\tmy $log = shift;\n> -\n> -\t# remove leading empty lines\n>...\n> -}\n> -\n> -sub git_print_simplified_log {\n> -\tmy $log = shift;\n> -\tmy $remove_title = shift;\n> -\n>...\n> -\tprint \"<br/>\\n\" unless $empty;\n> -}\n> -\n>  ## ......................................................................\n>  ## functions printing large fragments of HTML\n>...\n> @@ -2215,10 +2160,27 @@ sub git_log {\n>  \t\t      \"<br/>\\n\" .\n>  \t\t      \"</div>\\n\" .\n>  \t\t      \"<i>\" . esc_html($co{'author_name'}) .  \" [$ad{'rfc2822'}]</i><br/>\\n\" .\n> -\t\t      \"</div>\\n\";\n> -\n> -\t\tprint \"<div class=\\\"log_body\\\">\\n\";\n> -\t\tgit_print_simplified_log($co{'comment'});\n> +\t\t      \"</div>\\n\" .\n> +\t\t      \"<div class=\\\"log_body\\\">\\n\";\n>...\n> +\t\t\tprint format_log_line_html($line) . \"<br/>\\n\";\n> +\t\t}\n> +\t\tif (!$empty) {\n> +\t\t\tprint \"<br/>\\n\";\n> +\t\t}\n>  \t\tprint \"</div>\\n\";\n>  \t}\n\nObviously unrelated and probably unplanned revert of [2/7] in\nthe series, so will not apply.\n"},{"id":"25478","messageId":"8fe92b430608170308n42942798xf50f814052bee1c4@mail.gmail.com","threadId":"5305","inReplyTo":"7v8xlnsmyl.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 4/7] gitweb: Expand href() function to use key as param name for no mapping","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-08-17T10:08:06Z","receivedAt":"2006-08-17T10:08:06Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On 8/17/06, Junio C Hamano <junkio@cox.net> wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n>\n> > Expand href() function to use key name of params hash as a query param\n> > name, if there is no mapping for given key name.\n> >\n> > It is now safer to use href(); no errors, but links might not work\n> > correctly if caller didn't provide correct arguments.\n> >\n> > Future proofing.\n>\n> I think that is not a \"future proofing\" but is \"sweeping mess\n> under the rug\" ;-).\nAt least leave 'if (exists $mapping{$_})' even if you remove the 'else' part.\n\n[...]\n> Obviously unrelated and probably unplanned revert of [2/7] in\n> the series, so will not apply.\nOoops, sorry, I haven't noticed this... Very unplanned.\n\n-- \nJakub Narebski\n"},{"id":"25499","messageId":"Pine.LNX.4.63.0608171158330.22866@chino.corp.google.com","threadId":"5305","inReplyTo":"11558064894129-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 1/7] gitweb: Add support for per project git URLs","fromName":"David Rientjes","fromEmail":"rientjes@google.com","sentAt":"2006-08-17T18:58:53Z","receivedAt":"2006-08-17T18:58:53Z","isPatch":true,"sender":{"key":"rientjes@google.com","avatar":null},"body":"On Thu, 17 Aug 2006, Jakub Narebski wrote:\n\n> It is now possible for project to have individual clone/fetch URLs.\n> They are provided in new file 'cloneurl' added below project's\n> $GIT_DIR directory.\n> \n> If there is no cloneurl file, concatenation of git base URLs with\n> project name is used.\n> \n> This is merge of Jakub Narebski and David Rientjes\n>   gitweb: Show project's git URL on summary page\n> with Aneesh Kumar\n>   gitweb: Add support for cloneurl.\n>   gitweb: Support multiple clone urls\n> patches.\n> \n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@gmail.com>\n\nSigned-off-by: David Rientjes <rientjes@google.com>\n"}]}