{"thread":{"id":"21600","subject":"[RFC/PATCH 0/3] gitweb: Refactor common parts of log-like views","startedAt":"2009-11-13T01:02:11Z","lastAt":"2009-11-13T23:59:07Z","messageCount":6,"participants":["Jakub Narebski","Nanako Shiraishi"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"127482","messageId":"1258074134-27011-1-git-send-email-jnareb@gmail.com","threadId":"21600","inReplyTo":null,"subject":"[RFC/PATCH 0/3] gitweb: Refactor common parts of log-like views","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-13T01:02:11Z","receivedAt":"2009-11-13T01:02:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"This series extracts common parts of log-like views: 'log', 'shortlog'\nand 'history' view, into git_log_generic() subroutine.  This\nunification of code reduces code duplication, and brings features such\nas limiting the list of commits displayed using $hash_parent{,_base}\nfrom 'shortlog' view (added in ec3e97b (gitweb: shortlog now also\nobeys $hash_parent, 2008-08-08)).\n\nI have tested this series a bit (it passes both t9500 and t9501 test),\nbut I didn't test all the corner cases.\n\nThis series is preparation for even more refactoring planned, to make\nit easier to introduce new log-like action (new log formats).  It\ndoesn't include (for now) the 'search' view, neither in message search\nnot in pickaxe search form.\n\nJakub Narebski (3):\n  gitweb: Refactor 'log' action generation, adding git_log_body()\n  gitweb: Refactor common parts of 'log' and 'shortlog' views\n  gitweb: Make 'history' view (re)use git_log_generic()\n\n gitweb/gitweb.perl |  269 +++++++++++++++++++++-------------------------------\n 1 files changed, 110 insertions(+), 159 deletions(-)\n\n-- \nJakub Narebski\n"},{"id":"127483","messageId":"1258074134-27011-2-git-send-email-jnareb@gmail.com","threadId":"21600","inReplyTo":"1258074134-27011-1-git-send-email-jnareb@gmail.com","subject":"[PATCH 1/3] gitweb: Refactor 'log' action generation, adding git_log_body()","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-13T01:02:12Z","receivedAt":"2009-11-13T01:02:12Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Put the main part of 'log' view generation into git_log_body,\nsimilarly how it is done for 'shortlog' and 'history' views (and\nalso for 'tags' and 'heads' views).\n\nThis is preparation for extracting common code between 'log',\n'shortlog' and 'history' actions.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis is pure refactoring: output should change.\n\n gitweb/gitweb.perl |   81 ++++++++++++++++++++++++++++++---------------------\n 1 files changed, 48 insertions(+), 33 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex e4cbfc3..68dbd9e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4361,6 +4361,46 @@ sub git_project_list_body {\n \tprint \"</table>\\n\";\n }\n \n+sub git_log_body {\n+\t# uses global variable $project\n+\tmy ($commitlist, $from, $to, $refs, $extra) = @_;\n+\n+\t$from = 0 unless defined $from;\n+\t$to = $#{$commitlist} if (!defined $to || $#{$commitlist} < $to);\n+\n+\tfor (my $i = 0; $i <= $to; $i++) {\n+\t\tmy %co = %{$commitlist->[$i]};\n+\t\tnext if !%co;\n+\t\tmy $commit = $co{'id'};\n+\t\tmy $ref = format_ref_marker($refs, $commit);\n+\t\tmy %ad = parse_date($co{'author_epoch'});\n+\t\tgit_print_header_div('commit',\n+\t\t               \"<span class=\\\"age\\\">$co{'age_string'}</span>\" .\n+\t\t               esc_html($co{'title'}) . $ref,\n+\t\t               $commit);\n+\t\tprint \"<div class=\\\"title_text\\\">\\n\" .\n+\t\t      \"<div class=\\\"log_link\\\">\\n\" .\n+\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$commit)}, \"commit\") .\n+\t\t      \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"commitdiff\", hash=>$commit)}, \"commitdiff\") .\n+\t\t      \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$commit, hash_base=>$commit)}, \"tree\") .\n+\t\t      \"<br/>\\n\" .\n+\t\t      \"</div>\\n\";\n+\t\t      git_print_authorship(\\%co, -tag => 'span');\n+\t\t      print \"<br/>\\n</div>\\n\";\n+\n+\t\tprint \"<div class=\\\"log_body\\\">\\n\";\n+\t\tgit_print_log($co{'comment'}, -final_empty_line=> 1);\n+\t\tprint \"</div>\\n\";\n+\t}\n+\tif ($extra) {\n+\t\tprint \"<div class=\\\"page_nav\\\">\\n\";\n+\t\tprint \"$extra\\n\";\n+\t\tprint \"</div>\\n\";\n+\t}\n+}\n+\n sub git_shortlog_body {\n \t# uses global variable $project\n \tmy ($commitlist, $from, $to, $refs, $extra) = @_;\n@@ -5309,7 +5349,12 @@ sub git_log {\n \tmy @commitlist = parse_commits($hash, 101, (100 * $page));\n \n \tmy $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);\n-\n+\tmy $next_link;\n+\tif ($#commitlist >= 100) {\n+\t\t$next_link =\n+\t\t\t$cgi->a({-href => href(-replay=>1, page=>$page+1),\n+\t\t\t         -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n+\t}\n \tmy ($patch_max) = gitweb_get_feature('patches');\n \tif ($patch_max) {\n \t\tif ($patch_max < 0 || @commitlist <= $patch_max) {\n@@ -5328,39 +5373,9 @@ sub git_log {\n \t\tgit_print_header_div('summary', $project);\n \t\tprint \"<div class=\\\"page_body\\\"> Last change $co{'age_string'}.<br/><br/></div>\\n\";\n \t}\n-\tmy $to = ($#commitlist >= 99) ? (99) : ($#commitlist);\n-\tfor (my $i = 0; $i <= $to; $i++) {\n-\t\tmy %co = %{$commitlist[$i]};\n-\t\tnext if !%co;\n-\t\tmy $commit = $co{'id'};\n-\t\tmy $ref = format_ref_marker($refs, $commit);\n-\t\tmy %ad = parse_date($co{'author_epoch'});\n-\t\tgit_print_header_div('commit',\n-\t\t               \"<span class=\\\"age\\\">$co{'age_string'}</span>\" .\n-\t\t               esc_html($co{'title'}) . $ref,\n-\t\t               $commit);\n-\t\tprint \"<div class=\\\"title_text\\\">\\n\" .\n-\t\t      \"<div class=\\\"log_link\\\">\\n\" .\n-\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$commit)}, \"commit\") .\n-\t\t      \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"commitdiff\", hash=>$commit)}, \"commitdiff\") .\n-\t\t      \" | \" .\n-\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$commit, hash_base=>$commit)}, \"tree\") .\n-\t\t      \"<br/>\\n\" .\n-\t\t      \"</div>\\n\";\n-\t\t      git_print_authorship(\\%co, -tag => 'span');\n-\t\t      print \"<br/>\\n</div>\\n\";\n \n-\t\tprint \"<div class=\\\"log_body\\\">\\n\";\n-\t\tgit_print_log($co{'comment'}, -final_empty_line=> 1);\n-\t\tprint \"</div>\\n\";\n-\t}\n-\tif ($#commitlist >= 100) {\n-\t\tprint \"<div class=\\\"page_nav\\\">\\n\";\n-\t\tprint $cgi->a({-href => href(-replay=>1, page=>$page+1),\n-\t\t\t       -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n-\t\tprint \"</div>\\n\";\n-\t}\n+\tgit_log_body(\\@commitlist, 0, 99, $refs, $next_link);\n+\n \tgit_footer_html();\n }\n \n-- \n1.6.5\n"},{"id":"127484","messageId":"1258074134-27011-3-git-send-email-jnareb@gmail.com","threadId":"21600","inReplyTo":"1258074134-27011-1-git-send-email-jnareb@gmail.com","subject":"[PATCH 2/3] gitweb: Refactor common parts of 'log' and 'shortlog' views","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-13T01:02:13Z","receivedAt":"2009-11-13T01:02:13Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Put the common parts of git_log and git_shortlog into git_log_generic\nsubroutine: git_log and git_shortlog are now thin wrappers calling\ngit_log_generic with appropriate arguments.\n\nThe unification of code responsible for 'log' and 'shorlog' actions\nlead to the following changes in gitweb output\n * 'tree' link in page_nav now uses $hash parameter, as was the case\n   for 'shortlog' but not for 'log'\n * 'log' view now respect $hash_parent limiting, like 'shortlog' did\n * 'log' view doesn't have special case for empty list anymore, and it\n   always uses page_header linking to summary view, like 'shortlog'\n   did.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |   72 ++++++++++++++-------------------------------------\n 1 files changed, 20 insertions(+), 52 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 68dbd9e..14661cc 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -5336,7 +5336,9 @@ sub git_snapshot {\n \tclose $fd;\n }\n \n-sub git_log {\n+sub git_log_generic {\n+\tmy ($fmt_name, $body_subr) = @_;\n+\n \tmy $head = git_get_head_hash($project);\n \tif (!defined $hash) {\n \t\t$hash = $head;\n@@ -5346,16 +5348,21 @@ sub git_log {\n \t}\n \tmy $refs = git_get_references();\n \n-\tmy @commitlist = parse_commits($hash, 101, (100 * $page));\n+\tmy $commit_hash = $hash;\n+\tif (defined $hash_parent) {\n+\t\t$commit_hash = \"$hash_parent..$hash\";\n+\t}\n+\tmy @commitlist = parse_commits($commit_hash, 101, (100 * $page));\n \n-\tmy $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);\n-\tmy $next_link;\n+\tmy $paging_nav = format_paging_nav($fmt_name, $hash, $head,\n+\t                                   $page, $#commitlist >= 100);\n+\tmy $next_link = '';\n \tif ($#commitlist >= 100) {\n \t\t$next_link =\n \t\t\t$cgi->a({-href => href(-replay=>1, page=>$page+1),\n \t\t\t         -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n \t}\n-\tmy ($patch_max) = gitweb_get_feature('patches');\n+\tmy $patch_max = gitweb_get_feature('patches');\n \tif ($patch_max) {\n \t\tif ($patch_max < 0 || @commitlist <= $patch_max) {\n \t\t\t$paging_nav .= \" &sdot; \" .\n@@ -5365,20 +5372,18 @@ sub git_log {\n \t}\n \n \tgit_header_html();\n-\tgit_print_page_nav('log','', $hash,undef,undef, $paging_nav);\n-\n-\tif (!@commitlist) {\n-\t\tmy %co = parse_commit($hash);\n-\n-\t\tgit_print_header_div('summary', $project);\n-\t\tprint \"<div class=\\\"page_body\\\"> Last change $co{'age_string'}.<br/><br/></div>\\n\";\n-\t}\n+\tgit_print_page_nav($fmt_name,'', $hash,$hash,$hash, $paging_nav);\n+\tgit_print_header_div('summary', $project);\n \n-\tgit_log_body(\\@commitlist, 0, 99, $refs, $next_link);\n+\t$body_subr->(\\@commitlist, 0, 99, $refs, $next_link);\n \n \tgit_footer_html();\n }\n \n+sub git_log {\n+\tgit_log_generic('log', \\&git_log_body);\n+}\n+\n sub git_commit {\n \t$hash ||= $hash_base || \"HEAD\";\n \tmy %co = parse_commit($hash)\n@@ -6242,44 +6247,7 @@ EOT\n }\n \n sub git_shortlog {\n-\tmy $head = git_get_head_hash($project);\n-\tif (!defined $hash) {\n-\t\t$hash = $head;\n-\t}\n-\tif (!defined $page) {\n-\t\t$page = 0;\n-\t}\n-\tmy $refs = git_get_references();\n-\n-\tmy $commit_hash = $hash;\n-\tif (defined $hash_parent) {\n-\t\t$commit_hash = \"$hash_parent..$hash\";\n-\t}\n-\tmy @commitlist = parse_commits($commit_hash, 101, (100 * $page));\n-\n-\tmy $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);\n-\tmy $next_link = '';\n-\tif ($#commitlist >= 100) {\n-\t\t$next_link =\n-\t\t\t$cgi->a({-href => href(-replay=>1, page=>$page+1),\n-\t\t\t         -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n-\t}\n-\tmy $patch_max = gitweb_check_feature('patches');\n-\tif ($patch_max) {\n-\t\tif ($patch_max < 0 || @commitlist <= $patch_max) {\n-\t\t\t$paging_nav .= \" &sdot; \" .\n-\t\t\t\t$cgi->a({-href => href(action=>\"patches\", -replay=>1)},\n-\t\t\t\t\t\"patches\");\n-\t\t}\n-\t}\n-\n-\tgit_header_html();\n-\tgit_print_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);\n-\tgit_print_header_div('summary', $project);\n-\n-\tgit_shortlog_body(\\@commitlist, 0, 99, $refs, $next_link);\n-\n-\tgit_footer_html();\n+\tgit_log_generic('shortlog', \\&git_shortlog_body);\n }\n \n ## ......................................................................\n-- \n1.6.5\n"},{"id":"127485","messageId":"1258074134-27011-4-git-send-email-jnareb@gmail.com","threadId":"21600","inReplyTo":"1258074134-27011-1-git-send-email-jnareb@gmail.com","subject":"[PATCH 3/3] gitweb: Make 'history' view (re)use git_log_generic()","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-13T01:02:14Z","receivedAt":"2009-11-13T01:02:14Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Make git_history use git_log_generic, passing git_history_body as one\nof its paramaters.  This required changes to git_log_generic, in\nparticular passing more things as parameters.\n\nWhile refactoring common code of 'log', 'shortlog' and 'history' view,\nwe did unify pagination, using always the form used by 'history' view,\nnamely\n  first * prev * next\nin place of\n  HEAD * prev * next\nused by 'log' and 'shortlog' views.\n\nThe 'history' view now supports commit limiting via 'hpb' parameter,\nsimilarly to 'shortlog' (and 'log') view.  Performance of 'history'\nview got improved a bit, as it doesn't run git_get_hash_by_path for\n\"current\" version in a loop.  Error detection and reporting for\n'history' view changed a bit.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\n gitweb/gitweb.perl |  146 ++++++++++++++++++++-------------------------------\n 1 files changed, 57 insertions(+), 89 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 14661cc..5cfa507 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3363,22 +3363,18 @@ sub git_print_page_nav {\n }\n \n sub format_paging_nav {\n-\tmy ($action, $hash, $head, $page, $has_next_link) = @_;\n+\tmy ($action, $page, $has_next_link) = @_;\n \tmy $paging_nav;\n \n \n-\tif ($hash ne $head || $page) {\n-\t\t$paging_nav .= $cgi->a({-href => href(action=>$action)}, \"HEAD\");\n-\t} else {\n-\t\t$paging_nav .= \"HEAD\";\n-\t}\n-\n \tif ($page > 0) {\n-\t\t$paging_nav .= \" &sdot; \" .\n+\t\t$paging_nav .=\n+\t\t\t$cgi->a({-href => href(-replay=>1, page=>undef)}, \"first\") .\n+\t\t\t\" &sdot; \" .\n \t\t\t$cgi->a({-href => href(-replay=>1, page=>$page-1),\n \t\t\t         -accesskey => \"p\", -title => \"Alt-p\"}, \"prev\");\n \t} else {\n-\t\t$paging_nav .= \" &sdot; prev\";\n+\t\t$paging_nav .= \"first &sdot; prev\";\n \t}\n \n \tif ($has_next_link) {\n@@ -4447,7 +4443,8 @@ sub git_shortlog_body {\n \n sub git_history_body {\n \t# Warning: assumes constant type (blob or tree) during history\n-\tmy ($commitlist, $from, $to, $refs, $hash_base, $ftype, $extra) = @_;\n+\tmy ($commitlist, $from, $to, $refs, $extra,\n+\t    $file_name, $file_hash, $ftype) = @_;\n \n \t$from = 0 unless defined $from;\n \t$to = $#{$commitlist} unless (defined $to && $to <= $#{$commitlist});\n@@ -4481,7 +4478,7 @@ sub git_history_body {\n \t\t      $cgi->a({-href => href(action=>\"commitdiff\", hash=>$commit)}, \"commitdiff\");\n \n \t\tif ($ftype eq 'blob') {\n-\t\t\tmy $blob_current = git_get_hash_by_path($hash_base, $file_name);\n+\t\t\tmy $blob_current = $file_hash;\n \t\t\tmy $blob_parent  = git_get_hash_by_path($commit, $file_name);\n \t\t\tif (defined $blob_current && defined $blob_parent &&\n \t\t\t\t\t$blob_current ne $blob_parent) {\n@@ -5337,25 +5334,48 @@ sub git_snapshot {\n }\n \n sub git_log_generic {\n-\tmy ($fmt_name, $body_subr) = @_;\n+\tmy ($fmt_name, $body_subr, $base, $parent, $file_name, $file_hash) = @_;\n \n \tmy $head = git_get_head_hash($project);\n-\tif (!defined $hash) {\n-\t\t$hash = $head;\n+\tif (!defined $base) {\n+\t\t$base = $head;\n \t}\n \tif (!defined $page) {\n \t\t$page = 0;\n \t}\n \tmy $refs = git_get_references();\n \n-\tmy $commit_hash = $hash;\n-\tif (defined $hash_parent) {\n-\t\t$commit_hash = \"$hash_parent..$hash\";\n+\tmy $commit_hash = $base;\n+\tif (defined $parent) {\n+\t\t$commit_hash = \"$parent..$base\";\n+\t}\n+\tmy @commitlist =\n+\t\tparse_commits($commit_hash, 101, (100 * $page),\n+\t\t              defined $file_name ? ($file_name, \"--full-history\") : ());\n+\n+\tmy $ftype;\n+\tif (!defined $file_hash && defined $file_name) {\n+\t\t# some commits could have deleted file in question,\n+\t\t# and not have it in tree, but one of them has to have it\n+\t\tfor (my $i = 0; $i < @commitlist; $i++) {\n+\t\t\t$file_hash = git_get_hash_by_path($commitlist[$i]{'id'}, $file_name);\n+\t\t\tlast if defined $file_hash;\n+\t\t}\n+\t}\n+\tif (defined $file_hash) {\n+\t\t$ftype = git_get_type($file_hash);\n+\t}\n+\tif (defined $file_name && !defined $ftype) {\n+\t\tdie_error(500, \"Unknown type of object\");\n+\t}\n+\tmy %co;\n+\tif (defined $file_name) {\n+\t\t%co = parse_commit($base)\n+\t\t\tor die_error(404, \"Unknown commit object\");\n \t}\n-\tmy @commitlist = parse_commits($commit_hash, 101, (100 * $page));\n \n-\tmy $paging_nav = format_paging_nav($fmt_name, $hash, $head,\n-\t                                   $page, $#commitlist >= 100);\n+\n+\tmy $paging_nav = format_paging_nav($fmt_name, $page, $#commitlist >= 100);\n \tmy $next_link = '';\n \tif ($#commitlist >= 100) {\n \t\t$next_link =\n@@ -5363,7 +5383,7 @@ sub git_log_generic {\n \t\t\t         -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n \t}\n \tmy $patch_max = gitweb_get_feature('patches');\n-\tif ($patch_max) {\n+\tif ($patch_max && !defined $file_name) {\n \t\tif ($patch_max < 0 || @commitlist <= $patch_max) {\n \t\t\t$paging_nav .= \" &sdot; \" .\n \t\t\t\t$cgi->a({-href => href(action=>\"patches\", -replay=>1)},\n@@ -5373,15 +5393,23 @@ sub git_log_generic {\n \n \tgit_header_html();\n \tgit_print_page_nav($fmt_name,'', $hash,$hash,$hash, $paging_nav);\n-\tgit_print_header_div('summary', $project);\n+\tif (defined $file_name) {\n+\t\tgit_print_header_div('commit', esc_html($co{'title'}), $base);\n+\t} else {\n+\t\tgit_print_header_div('summary', $project)\n+\t}\n+\tgit_print_page_path($file_name, $ftype, $hash_base)\n+\t\tif (defined $file_name);\n \n-\t$body_subr->(\\@commitlist, 0, 99, $refs, $next_link);\n+\t$body_subr->(\\@commitlist, 0, 99, $refs, $next_link,\n+\t             $file_name, $file_hash, $ftype);\n \n \tgit_footer_html();\n }\n \n sub git_log {\n-\tgit_log_generic('log', \\&git_log_body);\n+\tgit_log_generic('log', \\&git_log_body,\n+\t                $hash, $hash_parent);\n }\n \n sub git_commit {\n@@ -5920,70 +5948,9 @@ sub git_patches {\n }\n \n sub git_history {\n-\tif (!defined $hash_base) {\n-\t\t$hash_base = git_get_head_hash($project);\n-\t}\n-\tif (!defined $page) {\n-\t\t$page = 0;\n-\t}\n-\tmy $ftype;\n-\tmy %co = parse_commit($hash_base)\n-\t    or die_error(404, \"Unknown commit object\");\n-\n-\tmy $refs = git_get_references();\n-\tmy $limit = sprintf(\"--max-count=%i\", (100 * ($page+1)));\n-\n-\tmy @commitlist = parse_commits($hash_base, 101, (100 * $page),\n-\t                               $file_name, \"--full-history\")\n-\t    or die_error(404, \"No such file or directory on given branch\");\n-\n-\tif (!defined $hash && defined $file_name) {\n-\t\t# some commits could have deleted file in question,\n-\t\t# and not have it in tree, but one of them has to have it\n-\t\tfor (my $i = 0; $i <= @commitlist; $i++) {\n-\t\t\t$hash = git_get_hash_by_path($commitlist[$i]{'id'}, $file_name);\n-\t\t\tlast if defined $hash;\n-\t\t}\n-\t}\n-\tif (defined $hash) {\n-\t\t$ftype = git_get_type($hash);\n-\t}\n-\tif (!defined $ftype) {\n-\t\tdie_error(500, \"Unknown type of object\");\n-\t}\n-\n-\tmy $paging_nav = '';\n-\tif ($page > 0) {\n-\t\t$paging_nav .=\n-\t\t\t$cgi->a({-href => href(action=>\"history\", hash=>$hash, hash_base=>$hash_base,\n-\t\t\t                       file_name=>$file_name)},\n-\t\t\t        \"first\");\n-\t\t$paging_nav .= \" &sdot; \" .\n-\t\t\t$cgi->a({-href => href(-replay=>1, page=>$page-1),\n-\t\t\t         -accesskey => \"p\", -title => \"Alt-p\"}, \"prev\");\n-\t} else {\n-\t\t$paging_nav .= \"first\";\n-\t\t$paging_nav .= \" &sdot; prev\";\n-\t}\n-\tmy $next_link = '';\n-\tif ($#commitlist >= 100) {\n-\t\t$next_link =\n-\t\t\t$cgi->a({-href => href(-replay=>1, page=>$page+1),\n-\t\t\t         -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n-\t\t$paging_nav .= \" &sdot; $next_link\";\n-\t} else {\n-\t\t$paging_nav .= \" &sdot; next\";\n-\t}\n-\n-\tgit_header_html();\n-\tgit_print_page_nav('history','', $hash_base,$co{'tree'},$hash_base, $paging_nav);\n-\tgit_print_header_div('commit', esc_html($co{'title'}), $hash_base);\n-\tgit_print_page_path($file_name, $ftype, $hash_base);\n-\n-\tgit_history_body(\\@commitlist, 0, 99,\n-\t                 $refs, $hash_base, $ftype, $next_link);\n-\n-\tgit_footer_html();\n+\tgit_log_generic('history', \\&git_history_body,\n+\t                $hash_base, $hash_parent_base,\n+\t                $file_name, $hash);\n }\n \n sub git_search {\n@@ -6247,7 +6214,8 @@ EOT\n }\n \n sub git_shortlog {\n-\tgit_log_generic('shortlog', \\&git_shortlog_body);\n+\tgit_log_generic('shortlog', \\&git_shortlog_body,\n+\t                $hash, $hash_parent);\n }\n \n ## ......................................................................\n-- \n1.6.5\n"},{"id":"127523","messageId":"20091114081050.6117@nanako3.lavabit.com","threadId":"21600","inReplyTo":"1258074134-27011-2-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH 1/3] gitweb: Refactor 'log' action generation, adding git_log_body()","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-11-13T23:10:50Z","receivedAt":"2009-11-13T23:10:50Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Jakub Narebski <jnareb@gmail.com>\n\n> Put the main part of 'log' view generation into git_log_body,\n> similarly how it is done for 'shortlog' and 'history' views (and\n> also for 'tags' and 'heads' views).\n>\n> This is preparation for extracting common code between 'log',\n> 'shortlog' and 'history' actions.\n>\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> This is pure refactoring: output should change.\n\nDid you mean \"should not change\"?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"127525","messageId":"200911140059.08084.jnareb@gmail.com","threadId":"21600","inReplyTo":"20091114081050.6117@nanako3.lavabit.com","subject":"Re: [PATCH 1/3] gitweb: Refactor 'log' action generation, adding git_log_body()","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-11-13T23:59:07Z","receivedAt":"2009-11-13T23:59:07Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 14 Nov 2009, Nanako Shiraishi wrote:\n> Quoting Jakub Narebski <jnareb@gmail.com>\n> \n> > Put the main part of 'log' view generation into git_log_body,\n> > similarly how it is done for 'shortlog' and 'history' views (and\n> > also for 'tags' and 'heads' views).\n> >\n> > This is preparation for extracting common code between 'log',\n> > 'shortlog' and 'history' actions.\n> >\n> > Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> > ---\n> > This is pure refactoring: output should change.\n> \n> Did you mean \"should not change\"?\n\nYes, of course, it should be \"output should not change\" (as opposed\nto later patches, which unify not only code but some of looks).\n\n-- \nJakub Narebski\nPoland\n"}]}