git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Move evaluate_gitweb_config out of run_request

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 5, 2010, 18:52 UTC
Message-ID
<20100705185136.30020.97751.stgit@localhost.localdomain>

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>
---
It joins bugfix (for FastCGI case) with improvements (probably better
performance for FastCGI case)
 gitweb/gitweb.perl |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9446376..1f611d2 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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;
Message 1 of 1 in “gitweb: Move evaluate_gitweb_config out of run_request”
  1. gitweb: Move evaluate_gitweb_config out of run_requestJakub Narebski, Jul 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.