Skip to content

Commit 869d588

Browse files
jnarebgitster
authored andcommitted
gitweb: Move evaluate_gitweb_config out of run_request
Move evaluate_gitweb_config() and evaluate_git_version() out of run_request() to run(), making them not run one for each request. This changes how git behaves in FastCGI case. This change makes it impossible to have config which changes with request, but I don't think anyone relied on such (hidden action) behavior. While at it, reset timer and number of git commands at beginning of run_request() in new reset_timer() subroutine. This fixes case when gitweb was run using FastCGI interface: time is reported for request, and not for single run of gitweb script. This changes slightly behavior in non-FastCGI case: the number of git commands reported is 1 less (running `git --version` one per gitweb is not counted now). Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ba0f03 commit 869d588

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

gitweb/gitweb.perl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,18 +1027,18 @@ sub dispatch {
10271027
$actions{$action}->();
10281028
}
10291029

1030-
sub run_request {
1030+
sub reset_timer {
10311031
our $t0 = [Time::HiRes::gettimeofday()]
10321032
if defined $t0;
1033+
our $number_of_git_cmds = 0;
1034+
}
1035+
1036+
sub run_request {
1037+
reset_timer();
10331038

10341039
evaluate_uri();
1035-
evaluate_gitweb_config();
1036-
evaluate_git_version();
10371040
check_loadavg();
10381041

1039-
# $projectroot and $projects_list might be set in gitweb config file
1040-
$projects_list ||= $projectroot;
1041-
10421042
evaluate_query_params();
10431043
evaluate_path_info();
10441044
evaluate_and_validate_params();
@@ -1086,6 +1086,11 @@ sub evaluate_argv {
10861086

10871087
sub run {
10881088
evaluate_argv();
1089+
evaluate_gitweb_config();
1090+
evaluate_git_version();
1091+
1092+
# $projectroot and $projects_list might be set in gitweb config file
1093+
$projects_list ||= $projectroot;
10891094

10901095
$pre_listen_hook->()
10911096
if $pre_listen_hook;

0 commit comments

Comments
 (0)