@matheusbsbs / matheus-bagliano / commits / 6be935115b
Fork 0

gitweb: Allow search to be disabled from the config file.

Signed-off-by: Robert Fitzsimons <robfitz@273k.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Robert Fitzsimons committed Dec 23, 2006 at 03:35 UTC 6be935115b4a3bfa9062875a569d4a018ac372e2
1 file changed +13
gitweb/gitweb.perl
+13
@@ -128,6 +128,12 @@ our %feature = (
128 # => [content-encoding, suffix, program]
129 'default' => ['x-gzip', 'gz', 'gzip']},
130
131 + # Enable text search, which will list the commits which match author,
132 + # committer or commit text to a given string. Enabled by default.
133 + 'search' => {
134 + 'override' => 0,
135 + 'default' => [1]},
136 +
137 # Enable the pickaxe search, which will list the commits that modified
138 # a given string in a file. This can be practical and quite faster
139 # alternative to 'blame', but still potentially CPU-intensive.
@@ -1730,6 +1736,9 @@ EOF
1736 print " / $action";
1737 }
1738 print "\n";
1739 + }
1740 + my ($have_search) = gitweb_check_feature('search');
1741 + if ((defined $project) && ($have_search)) {
1742 if (!defined $searchtext) {
1743 $searchtext = "";
1744 }
@@ -4151,6 +4160,10 @@ sub git_history {
4160 }
4161
4162 sub git_search {
4163 + my ($have_search) = gitweb_check_feature('search');
4164 + if (!$have_search) {
4165 + die_error('403 Permission denied', "Permission denied");
4166 + }
4167 if (!defined $searchtext) {
4168 die_error(undef, "Text field empty");
4169 }