t1501 (rev-parse): clarify
[gitweb.git] / gitweb / gitweb.perl
index 9446376535b1790c2400cd5bbc1e12f1a8b8f7c9..cedc3573136922d424971ef2a16feeb82496c37d 100755 (executable)
@@ -1027,18 +1027,18 @@ sub dispatch {
        $actions{$action}->();
 }
 
-sub run_request {
+sub reset_timer {
        our $t0 = [Time::HiRes::gettimeofday()]
                if defined $t0;
+       our $number_of_git_cmds = 0;
+}
+
+sub run_request {
+       reset_timer();
 
        evaluate_uri();
-       evaluate_gitweb_config();
-       evaluate_git_version();
        check_loadavg();
 
-       # $projectroot and $projects_list might be set in gitweb config file
-       $projects_list ||= $projectroot;
-
        evaluate_query_params();
        evaluate_path_info();
        evaluate_and_validate_params();
@@ -1086,6 +1086,11 @@ sub evaluate_argv {
 
 sub run {
        evaluate_argv();
+       evaluate_gitweb_config();
+       evaluate_git_version();
+
+       # $projectroot and $projects_list might be set in gitweb config file
+       $projects_list ||= $projectroot;
 
        $pre_listen_hook->()
                if $pre_listen_hook;
@@ -1322,8 +1327,7 @@ sub esc_param {
 sub esc_url {
        my $str = shift;
        return undef unless defined $str;
-       $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&=])/sprintf("%%%02X", ord($1))/eg;
-       $str =~ s/\+/%2B/g;
+       $str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&= ]+)/CGI::escape($1)/eg;
        $str =~ s/ /\+/g;
        return $str;
 }