Skip to content

Commit

Permalink
gitweb: Allow arbitrary strings to be dug with pickaxe
Browse files Browse the repository at this point in the history
Currently, there are rather draconian restrictions on the strings accepted
by the pickaxe search, which degrades its usefulness for digging in code
significantly. This patch remedies mentioned limitation.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Petr Baudis authored and Junio C Hamano committed May 18, 2007
1 parent e773855 commit 4229aa5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ sub check_export_ok {
our $searchtext = $cgi->param('s');
our $search_regexp;
if (defined $searchtext) {
if ($searchtype ne 'grep' and $searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
if ($searchtype ne 'grep' and $searchtype ne 'pickaxe' and $searchtext =~ m/[^a-zA-Z0-9_\.\/\-\+\:\@ ]/) {
die_error(undef, "Invalid search parameter");
}
if (length($searchtext) < 2) {
Expand Down Expand Up @@ -4725,8 +4725,10 @@ sub git_search {
my $alternate = 1;
$/ = "\n";
my $git_command = git_cmd_str();
my $searchqtext = $searchtext;
$searchqtext =~ s/'/'\\''/;
open my $fd, "-|", "$git_command rev-list $hash | " .
"$git_command diff-tree -r --stdin -S\'$searchtext\'";
"$git_command diff-tree -r --stdin -S\'$searchqtext\'";
undef %co;
my @files;
while (my $line = <$fd>) {
Expand Down

0 comments on commit 4229aa5

Please sign in to comment.