{"thread":{"id":"6085","subject":"[PATCH 3/3] gitweb: Allow search to be disabled from the config file.","startedAt":"2006-12-23T03:35:14Z","lastAt":"2006-12-23T22:43:19Z","messageCount":10,"participants":["Robert Fitzsimons","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"30139","messageId":"11668449162618-git-send-email-robfitz@273k.net","threadId":"6085","inReplyTo":null,"subject":"[PATCH 1/3] gitweb: Use rev-list pattern search options.","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T03:35:14Z","receivedAt":"2006-12-23T03:35:14Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"Use rev-list pattern search options instead of hand coded perl.\n\nSigned-off-by: Robert Fitzsimons <robfitz@273k.net>\n---\n gitweb/gitweb.perl |   20 ++++++++++----------\n 1 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ebbc397..cc6bd0c 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4172,20 +4172,20 @@ sub git_search {\n \tprint \"<table cellspacing=\\\"0\\\">\\n\";\n \tmy $alternate = 1;\n \tif ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {\n+\t\tmy $greptype;\n+\t\tif ($searchtype eq 'commit') {\n+\t\t\t$greptype = \"--grep=\";\n+\t\t} elsif ($searchtype eq 'author') {\n+\t\t\t$greptype = \"--author=\";\n+\t\t} elsif ($searchtype eq 'committer') {\n+\t\t\t$greptype = \"--committer=\";\n+\t\t}\n \t\t$/ = \"\\0\";\n \t\topen my $fd, \"-|\", git_cmd(), \"rev-list\",\n-\t\t\t\"--header\", \"--parents\", $hash, \"--\"\n+\t\t\t\"--header\", \"--parents\", ($greptype . $searchtext),\n+\t\t\t $hash, \"--\"\n \t\t\tor next;\n \t\twhile (my $commit_text = <$fd>) {\n-\t\t\tif (!grep m/$searchtext/i, $commit_text) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\tif ($searchtype eq 'author' && !grep m/\\nauthor .*$searchtext/i, $commit_text) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\tif ($searchtype eq 'committer' && !grep m/\\ncommitter .*$searchtext/i, $commit_text) {\n-\t\t\t\tnext;\n-\t\t\t}\n \t\t\tmy @commit_lines = split \"\\n\", $commit_text;\n \t\t\tmy %co = parse_commit(undef, \\@commit_lines);\n \t\t\tif (!%co) {\n-- \n1.4.4.3.gae7ae3\n"},{"id":"30140","messageId":"11668449271631-git-send-email-robfitz@273k.net","threadId":"6085","inReplyTo":"11668449162618-git-send-email-robfitz@273k.net","subject":"[PATCH 2/3] gitweb: Require a minimum of two character for the search text.","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T03:35:15Z","receivedAt":"2006-12-23T03:35:15Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"\nSigned-off-by: Robert Fitzsimons <robfitz@273k.net>\n---\n gitweb/gitweb.perl |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex cc6bd0c..6778b24 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -351,6 +351,9 @@ if (defined $searchtext) {\n \tif ($searchtext =~ m/[^a-zA-Z0-9_\\.\\/\\-\\+\\:\\@ ]/) {\n \t\tdie_error(undef, \"Invalid search parameter\");\n \t}\n+ \tif (length($searchtext) < 2) {\n+\t\tdie_error(undef, \"At least two characters are required for search parameter\");\n+\t}\n \t$searchtext = quotemeta $searchtext;\n }\n \n-- \n1.4.4.3.gae7ae3\n"},{"id":"30138","messageId":"11668449274162-git-send-email-robfitz@273k.net","threadId":"6085","inReplyTo":"11668449271631-git-send-email-robfitz@273k.net","subject":"[PATCH 3/3] gitweb: Allow search to be disabled from the config file.","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T03:35:16Z","receivedAt":"2006-12-23T03:35:16Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"\nSigned-off-by: Robert Fitzsimons <robfitz@273k.net>\n---\n gitweb/gitweb.perl |   13 +++++++++++++\n 1 files changed, 13 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 6778b24..e8f63aa 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -128,6 +128,12 @@ our %feature = (\n \t\t#         => [content-encoding, suffix, program]\n \t\t'default' => ['x-gzip', 'gz', 'gzip']},\n \n+\t# Enable text search, which will list the commits which match author, \n+\t# committer or commit text to a given string.  Enabled by default.\n+\t'search' => {\n+\t\t'override' => 0,\n+\t\t'default' => [1]},\n+\n \t# Enable the pickaxe search, which will list the commits that modified\n \t# a given string in a file. This can be practical and quite faster\n \t# alternative to 'blame', but still potentially CPU-intensive.\n@@ -1729,6 +1735,9 @@ EOF\n \t\t\tprint \" / $action\";\n \t\t}\n \t\tprint \"\\n\";\n+\t}\n+\tmy ($have_search) = gitweb_check_feature('search');\n+\tif ((defined $project) && ($have_search)) {\n \t\tif (!defined $searchtext) {\n \t\t\t$searchtext = \"\";\n \t\t}\n@@ -4147,6 +4156,10 @@ sub git_history {\n }\n \n sub git_search {\n+\tmy ($have_search) = gitweb_check_feature('search');\n+\tif (!$have_search) {\n+\t\tdie_error('403 Permission denied', \"Permission denied\");\n+\t}\n \tif (!defined $searchtext) {\n \t\tdie_error(undef, \"Text field empty\");\n \t}\n-- \n1.4.4.3.gae7ae3\n"},{"id":"30141","messageId":"20061223034629.GC11474@localhost","threadId":"6085","inReplyTo":"11668449162618-git-send-email-robfitz@273k.net","subject":"Re: [PATCH 1/3] gitweb: Use rev-list pattern search options.","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T03:46:29Z","receivedAt":"2006-12-23T03:46:29Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"I forgot the --compose flag on these.\n\nThe patch 1 is just a rewrite to take advantage of the native search\nsupport in rev-list, patch 2 and 3 are a slight change in functionality.\n\nRobert\n"},{"id":"30181","messageId":"emiomr$f4m$1@sea.gmane.org","threadId":"6085","inReplyTo":"11668449274162-git-send-email-robfitz@273k.net","subject":"Re: [PATCH 3/3] gitweb: Allow search to be disabled from the config file.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-23T08:20:15Z","receivedAt":"2006-12-23T08:20:15Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robert Fitzsimons wrote:\n\n[...]\nI'm not sure if it is worth disabling such not demanding in resources\n(contrary to pickaxe, blame and to some extent snapshot). Perhaps it would\nbe better to simply paginate search result, like \"history\" view got\npaginated?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"30182","messageId":"emiooi$f4m$2@sea.gmane.org","threadId":"6085","inReplyTo":"11668449162618-git-send-email-robfitz@273k.net","subject":"Re: [PATCH 1/3] gitweb: Use rev-list pattern search options.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-23T08:21:10Z","receivedAt":"2006-12-23T08:21:10Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robert Fitzsimons wrote:\n\n> Use rev-list pattern search options instead of hand coded perl.\n\nVery nice. Ack (FWIW).\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"30195","messageId":"20061223122841.GD11474@localhost","threadId":"6085","inReplyTo":"emiomr$f4m$1@sea.gmane.org","subject":"Re: [PATCH 3/3] gitweb: Allow search to be disabled from the config file.","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T12:28:41Z","receivedAt":"2006-12-23T12:28:41Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"> I'm not sure if it is worth disabling such not demanding in resources\n> (contrary to pickaxe, blame and to some extent snapshot). Perhaps it would\n> be better to simply paginate search result, like \"history\" view got\n> paginated?\n\nYes that makes sense.  I'll withdraw this patch and try and come up with\na new one which can paginate search results.\n\nRobert\n"},{"id":"30196","messageId":"200612231400.18774.jnareb@gmail.com","threadId":"6085","inReplyTo":"20061223122841.GD11474@localhost","subject":"Re: [PATCH 3/3] gitweb: Allow search to be disabled from the config file.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-23T13:00:18Z","receivedAt":"2006-12-23T13:00:18Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robert Fitzsimons wrote:\n> Jakub Narebski wrote:\n\n>> I'm not sure if it is worth disabling such not demanding in resources\n>> (contrary to pickaxe, blame and to some extent snapshot). Perhaps it would\n>> be better to simply paginate search result, like \"history\" view got\n>> paginated?\n> \n> Yes that makes sense.  I'll withdraw this patch and try and come up with\n> a new one which can paginate search results.\n\nBesides having removed search, it would follow removing search _form_.\nHmmm... perhaps we should add 'pickaxe' to search form only if it is\nenabled?\n\nSomething like (warning: this diff is certainly whitespace damaged!):\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 5feebaf..585d9fd 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1894,7 +1903,8 @@ EOF\n                      $cgi->hidden(-name => \"a\") . \"\\n\" .\n                      $cgi->hidden(-name => \"h\") . \"\\n\" .\n                      $cgi->popup_menu(-name => 'st', -default => 'commit',\n-                                      -values => ['commit', 'author', 'committer', 'pickaxe\n+                                      -values => ['commit', 'author', 'committer',\n+                                      gitweb_check_feature('pickaxe') ? 'pickaxe' : ()]) .\n                      $cgi->sup($cgi->a({-href => href(action=>\"search_help\")}, \"?\")) .\n                      \" search:\\n\",\n                      $cgi->textfield(-name => \"s\", -value => $searchtext) . \"\\n\" .\n\n\n\nTake a look how it was done for \"history\" view in commit 8be683520e\n  \"gitweb: Paginate history output\"\n\nAlthough with search you have additional complication with marking match,\nand \"log\" view like rather than \"shortlog\" like view... so I'm not sure\nif it would truly help. On the other hand you can use --skip option you\nhave introduced...\n-- \nJakub Narebski\nPoland\n"},{"id":"30204","messageId":"20061223145712.GE11474@localhost","threadId":"6085","inReplyTo":"200612231400.18774.jnareb@gmail.com","subject":"[PATCH] gitweb: Paginate commit/author/committer search output","fromName":"Robert Fitzsimons","fromEmail":"robfitz@273k.net","sentAt":"2006-12-23T14:57:12Z","receivedAt":"2006-12-23T14:57:12Z","isPatch":true,"sender":{"key":"robfitz@273k.net","avatar":null},"body":"Paginate commit/author/committer search output to only show 100 commits\nat a time, added appropriate nav links.\n\nSigned-off-by: Robert Fitzsimons <robfitz@273k.net>\n---\n\n\n> Although with search you have additional complication with marking match,\n> and \"log\" view like rather than \"shortlog\" like view... so I'm not sure\n> if it would truly help. On the other hand you can use --skip option you\n> have introduced...\n\nI used the slower non--skip workflow for the moment, so at least there\nis no need to upgrade the core git commands.\n\nRobert\n\n\n gitweb/gitweb.perl |  148 ++++++++++++++++++++++++++++++++++++----------------\n 1 files changed, 103 insertions(+), 45 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex cc6bd0c..e4378b9 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2837,6 +2837,58 @@ sub git_heads_body {\n \tprint \"</table>\\n\";\n }\n \n+sub git_search_grep_body {\n+\tmy ($greplist, $from, $to, $extra) = @_;\n+\t$from = 0 unless defined $from;\n+\t$to = $#{$greplist} if (!defined $to || $#{$greplist} < $to);\n+\n+\tprint \"<table class=\\\"grep\\\" cellspacing=\\\"0\\\">\\n\";\n+\tmy $alternate = 1;\n+\tfor (my $i = $from; $i <= $to; $i++) {\n+\t\tmy $commit = $greplist->[$i];\n+\t\tmy %co = parse_commit($commit);\n+\t\tif (!%co) {\n+\t\t\tnext;\n+\t\t}\n+\t\tif ($alternate) {\n+\t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n+\t\t} else {\n+\t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n+\t\t}\n+\t\t$alternate ^= 1;\n+\t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n+\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 15, 5)) . \"</i></td>\\n\" .\n+\t\t      \"<td>\" .\n+\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'}), -class => \"list subject\"},\n+\t\t\t       esc_html(chop_str($co{'title'}, 50)) . \"<br/>\");\n+\t\tmy $comment = $co{'comment'};\n+\t\tforeach my $line (@$comment) {\n+\t\t\tif ($line =~ m/^(.*)($searchtext)(.*)$/i) {\n+\t\t\t\tmy $lead = esc_html($1) || \"\";\n+\t\t\t\t$lead = chop_str($lead, 30, 10);\n+\t\t\t\tmy $match = esc_html($2) || \"\";\n+\t\t\t\tmy $trail = esc_html($3) || \"\";\n+\t\t\t\t$trail = chop_str($trail, 30, 10);\n+\t\t\t\tmy $text = \"$lead<span class=\\\"match\\\">$match</span>$trail\";\n+\t\t\t\tprint chop_str($text, 80, 5) . \"<br/>\\n\";\n+\t\t\t}\n+\t\t}\n+\t\tprint \"</td>\\n\" .\n+\t\t      \"<td class=\\\"link\\\">\" .\n+\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'})}, \"commit\") .\n+\t\t      \" | \" .\n+\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$co{'tree'}, hash_base=>$co{'id'})}, \"tree\");\n+\t\tprint \"</td>\\n\" .\n+\t\t      \"</tr>\\n\";\n+\t}\n+\tif (defined $extra) {\n+\t\tprint \"<tr>\\n\" .\n+\t\t      \"<td colspan=\\\"3\\\">$extra</td>\\n\" .\n+\t\t      \"</tr>\\n\";\n+\t}\n+\tprint \"</table>\\n\";\n+}\n+\n ## ======================================================================\n ## ======================================================================\n ## actions\n@@ -4154,6 +4206,9 @@ sub git_search {\n \tif (!%co) {\n \t\tdie_error(undef, \"Unknown commit object\");\n \t}\n+\tif (!defined $page) {\n+\t\t$page = 0;\n+\t}\n \n \t$searchtype ||= 'commit';\n \tif ($searchtype eq 'pickaxe') {\n@@ -4166,11 +4221,7 @@ sub git_search {\n \t}\n \n \tgit_header_html();\n-\tgit_print_page_nav('','', $hash,$co{'tree'},$hash);\n-\tgit_print_header_div('commit', esc_html($co{'title'}), $hash);\n \n-\tprint \"<table cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 1;\n \tif ($searchtype eq 'commit' or $searchtype eq 'author' or $searchtype eq 'committer') {\n \t\tmy $greptype;\n \t\tif ($searchtype eq 'commit') {\n@@ -4180,52 +4231,58 @@ sub git_search {\n \t\t} elsif ($searchtype eq 'committer') {\n \t\t\t$greptype = \"--committer=\";\n \t\t}\n-\t\t$/ = \"\\0\";\n \t\topen my $fd, \"-|\", git_cmd(), \"rev-list\",\n-\t\t\t\"--header\", \"--parents\", ($greptype . $searchtext),\n-\t\t\t $hash, \"--\"\n+\t\t\t(\"--max-count=\" . (100 * ($page+1))),\n+\t\t\t($greptype . $searchtext),\n+\t\t\t$hash, \"--\"\n \t\t\tor next;\n-\t\twhile (my $commit_text = <$fd>) {\n-\t\t\tmy @commit_lines = split \"\\n\", $commit_text;\n-\t\t\tmy %co = parse_commit(undef, \\@commit_lines);\n-\t\t\tif (!%co) {\n-\t\t\t\tnext;\n-\t\t\t}\n-\t\t\tif ($alternate) {\n-\t\t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n-\t\t\t} else {\n-\t\t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n-\t\t\t}\n-\t\t\t$alternate ^= 1;\n-\t\t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n-\t\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 15, 5)) . \"</i></td>\\n\" .\n-\t\t\t      \"<td>\" .\n-\t\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'}), -class => \"list subject\"},\n-\t\t\t               esc_html(chop_str($co{'title'}, 50)) . \"<br/>\");\n-\t\t\tmy $comment = $co{'comment'};\n-\t\t\tforeach my $line (@$comment) {\n-\t\t\t\tif ($line =~ m/^(.*)($searchtext)(.*)$/i) {\n-\t\t\t\t\tmy $lead = esc_html($1) || \"\";\n-\t\t\t\t\t$lead = chop_str($lead, 30, 10);\n-\t\t\t\t\tmy $match = esc_html($2) || \"\";\n-\t\t\t\t\tmy $trail = esc_html($3) || \"\";\n-\t\t\t\t\t$trail = chop_str($trail, 30, 10);\n-\t\t\t\t\tmy $text = \"$lead<span class=\\\"match\\\">$match</span>$trail\";\n-\t\t\t\t\tprint chop_str($text, 80, 5) . \"<br/>\\n\";\n-\t\t\t\t}\n-\t\t\t}\n-\t\t\tprint \"</td>\\n\" .\n-\t\t\t      \"<td class=\\\"link\\\">\" .\n-\t\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'})}, \"commit\") .\n-\t\t\t      \" | \" .\n-\t\t\t      $cgi->a({-href => href(action=>\"tree\", hash=>$co{'tree'}, hash_base=>$co{'id'})}, \"tree\");\n-\t\t\tprint \"</td>\\n\" .\n-\t\t\t      \"</tr>\\n\";\n-\t\t}\n+\t\tmy @revlist = map { chomp; $_ } <$fd>;\n \t\tclose $fd;\n+\n+\t\tmy $paging_nav = '';\n+\t\tif ($page > 0) {\n+\t\t\t$paging_nav .=\n+\t\t\t\t$cgi->a({-href => href(action=>\"search\", hash=>$hash,\n+\t\t\t\t\t\t       searchtext=>$searchtext, searchtype=>$searchtype)},\n+\t\t\t\t\t\"first\");\n+\t\t\t$paging_nav .= \" &sdot; \" .\n+\t\t\t\t$cgi->a({-href => href(action=>\"search\", hash=>$hash,\n+\t\t\t\t\t\t       searchtext=>$searchtext, searchtype=>$searchtype,\n+\t\t\t\t\t\t       page=>$page-1),\n+\t\t\t\t\t -accesskey => \"p\", -title => \"Alt-p\"}, \"prev\");\n+\t\t} else {\n+\t\t\t$paging_nav .= \"first\";\n+\t\t\t$paging_nav .= \" &sdot; prev\";\n+\t\t}\n+\t\tif ($#revlist >= (100 * ($page+1)-1)) {\n+\t\t\t$paging_nav .= \" &sdot; \" .\n+\t\t\t\t$cgi->a({-href => href(action=>\"search\", hash=>$hash,\n+\t\t\t\t\t\t       searchtext=>$searchtext, searchtype=>$searchtype,\n+\t\t\t\t\t\t       page=>$page+1),\n+\t\t\t\t\t -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n+\t\t} else {\n+\t\t\t$paging_nav .= \" &sdot; next\";\n+\t\t}\n+\t\tmy $next_link = '';\n+\t\tif ($#revlist >= (100 * ($page+1)-1)) {\n+\t\t\t$next_link =\n+\t\t\t\t$cgi->a({-href => href(action=>\"search\", hash=>$hash,\n+\t\t\t\t\t\t       searchtext=>$searchtext, searchtype=>$searchtype,\n+\t\t\t\t\t\t       page=>$page+1),\n+\t\t\t\t\t -accesskey => \"n\", -title => \"Alt-n\"}, \"next\");\n+\t\t}\n+\n+\t\tgit_print_page_nav('','', $hash,$co{'tree'},$hash, $paging_nav);\n+\t\tgit_print_header_div('commit', esc_html($co{'title'}), $hash);\n+\t\tgit_search_grep_body(\\@revlist, ($page * 100), $#revlist, $next_link);\n \t}\n \n \tif ($searchtype eq 'pickaxe') {\n+\t\tgit_print_page_nav('','', $hash,$co{'tree'},$hash);\n+\t\tgit_print_header_div('commit', esc_html($co{'title'}), $hash);\n+\n+\t\tprint \"<table cellspacing=\\\"0\\\">\\n\";\n+\t\tmy $alternate = 1;\n \t\t$/ = \"\\n\";\n \t\tmy $git_command = git_cmd_str();\n \t\topen my $fd, \"-|\", \"$git_command rev-list $hash | \" .\n@@ -4280,8 +4337,9 @@ sub git_search {\n \t\t\t}\n \t\t}\n \t\tclose $fd;\n+\n+\t\tprint \"</table>\\n\";\n \t}\n-\tprint \"</table>\\n\";\n \tgit_footer_html();\n }\n \n-- \n1.4.4.3.gae7ae3\n"},{"id":"30213","messageId":"200612232343.20815.jnareb@gmail.com","threadId":"6085","inReplyTo":"20061223145712.GE11474@localhost","subject":"Re: [PATCH] gitweb: Paginate commit/author/committer search output","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-23T22:43:19Z","receivedAt":"2006-12-23T22:43:19Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robert Fitzsimons wrote:\n> Paginate commit/author/committer search output to only show 100 commits\n> at a time, added appropriate nav links.\n> \n> Signed-off-by: Robert Fitzsimons <robfitz@273k.net>\n> --- \n> \n>> Although with search you have additional complication with marking match,\n>> and \"log\" view like rather than \"shortlog\" like view... so I'm not sure\n>> if it would truly help. On the other hand you can use --skip option you\n>> have introduced...\n> \n> I used the slower non--skip workflow for the moment, so at least there\n> is no need to upgrade the core git commands.\n\nFirst, git has tradition of introducing options (first) meant for gitweb,\nand immediately making use of them. Examples: --git-dir=<path> option to\ngit wrapper because in mod_perl doesn't pass environmental variables to\nsubprocesses so setting $ENV{'GIT_DIR'} in gitweb wouldn't work;\n--full-history option to git-rev-list for \"history\" view, because using\npath limit instead of piping to git-diff-tree and using path limit of\ngit-diff-tree changed returned revisions, git-for-each-ref introduced\nfor better gitweb performance in \"summary\" view... So you wouldn't do\nsomething unusual. And it is fairly easy to compile and install additional,\nnewest version of git.\n\nSecond, without --skip you have ugly tradeoff if you want to paginate\n(search result, but not only that): either get pages*page-size revisions\nand call parse_commit which in turn usually calls git-rev-list page-size\ntimes; or get full info pages*page-size and skip (pages - 1)*page-size\nbits of output.\n\nAnd finally, --skip with your abandoned for now parsing revisions not\none by one, but by a bunch using one git command call would help\nperformance not only of non-pickaxe search, but also history view,\nand log and shortlog views.\n\n[...]\n> +sub git_search_grep_body {\n\nI'm not sure if it wouldn't be better to try to reuse git_log machinery,\njust adding marking match, and removing everything but the immediate\ncontext of match, to format_log_line_html... Just a thought...\n\n-- \nJakub Narebski\nPoland\n"}]}