Anonymous avatar Anonymous committed 869d588

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 <jnareb@gmail.com>;
Signed-off-by: Junio C Hamano <gitster@pobox.com>;

Comments (0)

Files changed (1)

gitweb/gitweb.perl

 	$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();
 
 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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.