Add filename search config option and add it to the drop-down. --- gitweb/gitweb.perl | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4a7b0a5..087b4cb 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -374,6 +374,20 @@ our %feature = ( 'override' => 0, 'default' => [1]}, + # Enable the filename search, which will list the files whose + # names contain the given string. Enabled by default. Note + # that you need to have 'search' feature enabled too. + + # To enable system wide have in $GITWEB_CONFIG + # $feature{'filename'}{'default'} = [1]; + # To have project specific config enable override in $GITWEB_CONFIG + # $feature{'filename'}{'override'} = 1; + # and in project config gitweb.pickaxe = 0|1; + 'filename' => { + 'sub' => sub { feature_bool('filename', @_) }, + 'override' => 0, + 'default' => [1]}, + # Enable showing size of blobs in a 'tree' view, in a separate # column, similar to what 'ls -l' does. This cost a bit of IO. @@ -4034,7 +4048,7 @@ sub print_search_form { $cgi->input({-name=>"a", -value=>"search", -type=>"hidden"}) . "\n" . $cgi->input({-name=>"h", -value=>$search_hash, -type=>"hidden"}) . "\n" . $cgi->popup_menu(-name => 'st', -default => 'commit', - -values => ['commit', 'grep', 'author', 'committer', 'pickaxe']) . + -values => ['commit', 'grep', 'author', 'committer', 'pickaxe', 'filename']) . $cgi->sup($cgi->a({-href => href(action=>"search_help")}, "?")) . " search:\n", $cgi->textfield(-name => "s", -value => $searchtext, -override => 1) . "\n" . @@ -7996,6 +8010,12 @@ sub git_search { or die_error(403, "Grep search is disabled"); } + if ($searchtype eq 'filename') { + # uses grep on output of git ls-tree, maybe CPU-intensive + gitweb_check_feature('filename') + or die_error(403, "Filename search is disabled"); + } + if (!defined $searchtext) { die_error(400, "Text field is empty"); } @@ -8018,6 +8038,8 @@ sub git_search { git_search_changes(%co); } elsif ($searchtype eq 'grep') { git_search_files(%co); + } elsif ($searchtype eq 'filename') { + git_search_filenames(%co); } else { die_error(400, "Unknown search type"); } -- 1.8.3.msysgit.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html