{"thread":{"id":"21933","subject":"[PATCH 2/6] GITWEB - Missmatching git w/ gitweb","startedAt":"2009-12-10T23:45:37Z","lastAt":"2009-12-19T13:32:11Z","messageCount":40,"participants":["John 'Warthog9' Hawley","Sverre Rabbelier","Jakub Narebski","Junio C Hamano","J.H.","Johannes Schindelin","Mihamina Rakotomandimby"],"isPatch":true,"patchVersion":1,"patchTotal":6},"messages":[{"id":"129715","messageId":"1260488743-25855-1-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":null,"subject":"[PATCH 0/6] Gitweb caching changes v2","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:37Z","receivedAt":"2009-12-10T23:45:37Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nEvening everyone,\n\nThis is the latest incarnation of gitweb w/ caching.  This is finally at the point where it should probably start either being considered for inclusion or mainline, or I need to accept that this will never get in and more perminantely fork (as is the case with Fedora where this is going in as gitweb-caching as a parrallel rpm package).\n\nThat said this brings the base up to mainline (again), it updates a number of elements in the caching engine, and this is a much cleaner break-out of the tree vs. what I am currently developing against.\n\nNew things known to work:\n    - Better breakout\n    - You can actually disable the cache now\n\n- John 'Warthog9' Hawley \n\nJohn 'Warthog9' Hawley (6):\n  GITWEB - Load Checking\n  GITWEB - Missmatching git w/ gitweb\n  GITWEB - Add git:// link to summary pages\n  GITWEB - Makefile changes\n  GITWEB - File based caching layer\n  GITWEB - Separate defaults from main file\n\n .gitignore                  |    1 +\n Makefile                    |   15 +-\n gitweb/Makefile             |   14 +\n gitweb/cache.pm             |  293 +++++++\n gitweb/gitweb.css           |    6 +\n gitweb/gitweb.perl          | 1821 ++++++++++++++++++++-----------------------\n gitweb/gitweb_defaults.perl |  468 +++++++++++\n 7 files changed, 1651 insertions(+), 967 deletions(-)\n create mode 100644 gitweb/Makefile\n create mode 100644 gitweb/cache.pm\n create mode 100644 gitweb/gitweb_defaults.perl\n"},{"id":"129716","messageId":"1260488743-25855-2-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":"1260488743-25855-1-git-send-email-warthog9@kernel.org","subject":"[PATCH 1/6] GITWEB - Load Checking","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:38Z","receivedAt":"2009-12-10T23:45:38Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nThis changes the behavior, slightly, of gitweb so that it verifies\nthat the box isn't inundated with before attempting to serve gitweb.\nIf the box is overloaded, it basically returns a 503 server unavailable\nuntil the load falls below the defined threshold.  This helps dramatically\nif you have a box that's I/O bound, reaches a certain load and you\ndon't want gitweb, the I/O hog that it is, increasing the pain the\nserver is already undergoing.\n\nadds $maxload configuration variable.  Default is a load of 300,\nwhich for most cases should never be hit.\n\nPlease note this makes the assumption that /proc/loadavg exists\nas there is no good way to read load averages on a great number of\nplatforms [READ: Windows], or that it's reasonably accurate.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n---\n gitweb/gitweb.perl |   24 ++++++++++++++++++++++++\n 1 files changed, 24 insertions(+), 0 deletions(-)\n\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7e477af..813e48f 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -221,6 +221,11 @@ our %avatar_size = (\n \t'double'  => 32\n );\n \n+# Used to set the maximum load that we will still respond to gitweb queries.\n+# if we exceed this than we do the processing to figure out if there's a mirror\n+# and redirect to it, or to just return 503 server busy\n+our $maxload = 300;\n+\n # You define site-wide feature defaults here; override them with\n # $GITWEB_CONFIG as necessary.\n our %feature = (\n@@ -551,6 +556,25 @@ if (-e $GITWEB_CONFIG) {\n \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n }\n \n+# loadavg throttle\n+sub get_loadavg() {\n+    my $load;\n+    my @loads;\n+\n+    open($load, '<', '/proc/loadavg') or return 0;\n+    @loads = split(/\\s+/, scalar <$load>);\n+    close($load);\n+    return $loads[0];\n+}\n+\n+if (get_loadavg() > $maxload) {\n+    print \"Content-Type: text/plain\\n\";\n+    print \"Status: 503 Excessive load on server\\n\";\n+    print \"\\n\";\n+    print \"The load average on the server is too high\\n\";\n+    exit 0;\n+}\n+\n # version of the core git binary\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n $number_of_git_cmds++;\n"},{"id":"129714","messageId":"1260488743-25855-3-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":"1260488743-25855-2-git-send-email-warthog9@kernel.org","subject":"[PATCH 2/6] GITWEB - Missmatching git w/ gitweb","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:39Z","receivedAt":"2009-12-10T23:45:39Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nThis adds $missmatch_git so that gitweb can run with a miss-matched\ngit install.  Gitweb, generally, runs fine on a very broad range of\ngit versions, but it's not always practicle or useful to upgrade it\nevery time you upgrade git.\n\nThis allows the administrator to realize they are miss-matched, and\nshould they be so inclined, disable the check entirely and run in\na miss-matched fasion.\n\nThis is more here to give an obvious warning as to whats going on\nvs. silently failing.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n---\n gitweb/gitweb.perl |   22 ++++++++++++++++++++++\n 1 files changed, 22 insertions(+), 0 deletions(-)\n\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 813e48f..d84f4c0 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -221,6 +221,9 @@ our %avatar_size = (\n \t'double'  => 32\n );\n \n+# This is here to allow for missmatch git & gitweb versions\n+our $missmatch_git = '';\n+\n # Used to set the maximum load that we will still respond to gitweb queries.\n # if we exceed this than we do the processing to figure out if there's a mirror\n # and redirect to it, or to just return 503 server busy\n@@ -579,6 +582,25 @@ if (get_loadavg() > $maxload) {\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n $number_of_git_cmds++;\n \n+# There's a pretty serious flaw that we silently fail if git doesn't find something it needs\n+# a quick and simple check is to have gitweb do a simple check - are we running on the same\n+# version of git that we shipped with - if not, throw up an error so that people doing\n+# first installs don't have to debug perl to figure out whats going on\n+if (\n+\t$git_version ne $version\n+\t&&\n+\t$missmatch_git eq ''\n+){\n+\tgit_header_html();\n+\tprint \"<p><b>*** Warning ***</b></p>\\n\";\n+\tprint \"<p>\\n\";\n+\tprint \"This version of gitweb was compiled for <b>$version</b> however git version <b>$git_version</b> was found<br/>\\n\";\n+\tprint \"If you are sure this version of git works with this version of gitweb - please define <b>\\$missmatch_git</b> to a non empty string in your git config file.\\n\";\n+\tprint \"</p>\\n\";\n+\tgit_footer_html();\n+\texit;\n+}\n+\n $projects_list ||= $projectroot;\n \n # ======================================================================\n"},{"id":"129717","messageId":"1260488743-25855-4-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":"1260488743-25855-3-git-send-email-warthog9@kernel.org","subject":"[PATCH 3/6] GITWEB - Add git:// link to summary pages","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:40Z","receivedAt":"2009-12-10T23:45:40Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nThis adds a git:// link to the summary pages should a common\n$gitlinkurl be defined (default is nothing defined, thus nothing\nshown)\n\nThis does make the assumption that the git trees share a common\npath, and nothing to date is known to actually make use of the link\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n---\n gitweb/gitweb.perl |    8 ++++++++\n 1 files changed, 8 insertions(+), 0 deletions(-)\n\n\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex d84f4c0..7ad096c 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -224,6 +224,10 @@ our %avatar_size = (\n # This is here to allow for missmatch git & gitweb versions\n our $missmatch_git = '';\n \n+#This is here to deal with an extra link on the summary pages - if it's left blank\n+# this link will not be shwon.  If it's set, this will be prepended to the repo and used\n+our $gitlinkurl = '';\n+\n # Used to set the maximum load that we will still respond to gitweb queries.\n # if we exceed this than we do the processing to figure out if there's a mirror\n # and redirect to it, or to just return 503 server busy\n@@ -4454,6 +4458,10 @@ sub git_project_list_body {\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"log\")}, \"log\") . \" | \" .\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"tree\")}, \"tree\") .\n \t\t      ($pr->{'forks'} ? \" | \" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"forks\")}, \"forks\") : '') .\n+     \t\tif( $gitlinkurl ne '' ){\n+\t\t\tprint \" | \". $cgi->a({-href => \"git://$gitlinkurl/\".esc_html($pr->{'path'})}, \"git\");\n+\t\t}\n+\t\tprint \"\".\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\\n\";\n \t}\n"},{"id":"129718","messageId":"1260488743-25855-5-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":"1260488743-25855-4-git-send-email-warthog9@kernel.org","subject":"[PATCH 4/6] GITWEB - Makefile changes","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:41Z","receivedAt":"2009-12-10T23:45:41Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nThis adjust the makefiles so that you can do such things as\n\n\tmake gitweb\n\nfrom the top level make tree, or if your in the gitweb directory\nitself typing\n\n\tmake\n\nwill call back up to the main Makefile and build gitweb\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n---\n Makefile        |    4 +++-\n gitweb/Makefile |   14 ++++++++++++++\n 2 files changed, 17 insertions(+), 1 deletions(-)\n create mode 100644 gitweb/Makefile\n\n\n\ndiff --git a/Makefile b/Makefile\nindex 4a1e5bc..8db9d01 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1509,6 +1509,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \n+.PHONY: gitweb\n+gitweb: gitweb/gitweb.cgi\n ifdef JSMIN\n OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n@@ -1537,7 +1539,7 @@ endif\n \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n-\t    $< >$@+ && \\\n+\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nnew file mode 100644\nindex 0000000..8d318b3\n--- /dev/null\n+++ b/gitweb/Makefile\n@@ -0,0 +1,14 @@\n+SHELL = /bin/bash\n+\n+FILES = gitweb.cgi\n+\n+.PHONY: $(FILES)\n+\n+all: $(FILES)\n+\n+$(FILES):\n+\t$(MAKE) $(MFLAGS) -C ../ -f Makefile gitweb/$@\n+\n+clean:\n+\trm -rf $(FILES)\n+\n"},{"id":"129719","messageId":"1260488743-25855-7-git-send-email-warthog9@kernel.org","threadId":"21933","inReplyTo":"1260488743-25855-6-git-send-email-warthog9@kernel.org","subject":"[PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"John 'Warthog9' Hawley","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-10T23:45:43Z","receivedAt":"2009-12-10T23:45:43Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"\nThis is an attempt to break out the default values & associated\ndocumentation from the main gitweb file so that it's easier to\nbrowse / read and understand without the associated code involved.\n\nThis helps by making defaults self contained with their documentation\nmaking it easier for someone to read through things and find what\nthey want\n\nThis is also a not-so-subtle start of trying to break up gitweb into\nseparate files for easier maintainability, having everything in a\nsingle file is just a mess and makes the whole thing more complicated\nthan it needs to be.  This is a bit of a baby step towards breaking it\nup for easier maintenance.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n---\n .gitignore                  |    1 +\n Makefile                    |   15 +-\n gitweb/Makefile             |    2 +-\n gitweb/gitweb.perl          |  515 +++++--------------------------------------\n gitweb/gitweb_defaults.perl |  468 +++++++++++++++++++++++++++++++++++++++\n 5 files changed, 537 insertions(+), 464 deletions(-)\n create mode 100644 gitweb/gitweb_defaults.perl\n\n\n\ndiff --git a/.gitignore b/.gitignore\nindex ac02a58..5e48102 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -151,6 +151,7 @@\n /git-core-*/?*\n /gitk-git/gitk-wish\n /gitweb/gitweb.cgi\n+/gitweb/gitweb_defaults.pl\n /test-chmtime\n /test-ctype\n /test-date\ndiff --git a/Makefile b/Makefile\nindex 8db9d01..2c5f139 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1510,14 +1510,16 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \tmv $@+ $@\n \n .PHONY: gitweb\n-gitweb: gitweb/gitweb.cgi\n+gitweb: gitweb/gitweb.cgi gitweb/gitweb_defaults.pl\n ifdef JSMIN\n-OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n-gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n+OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js gitweb/gitweb_defaults.pl\n+gitweb/gitweb.cgi gitweb/gitweb_defaults.pl: gitweb/gitweb.perl gitweb/gitweb.min.js gitweb/gitweb_defaults.perl\n else\n-OTHER_PROGRAMS += gitweb/gitweb.cgi\n-gitweb/gitweb.cgi: gitweb/gitweb.perl\n+OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb_defaults.pl\n+gitweb/gitweb.cgi: gitweb/gitweb_defaults.pl\n+gitweb/gitweb.cgi gitweb/gitweb_defaults.pl: gitweb/gitweb.perl gitweb/gitweb_defaults.perl\n endif\n+\t#$(QUIET_GEN)$(RM) $@ $@+ &&\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n \tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n@@ -1539,7 +1541,7 @@ endif\n \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n-\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n+\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl, %.perl, $@)) >$@+ && \\\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \n@@ -1913,6 +1915,7 @@ clean:\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n \t$(RM) gitweb/gitweb.cgi\n+\t$(RM) gitweb/gitweb_defaults.pl\n \t$(MAKE) -C perl clean\n endif\n \t$(MAKE) -C templates/ clean\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex 8d318b3..2bd421a 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -1,6 +1,6 @@\n SHELL = /bin/bash\n \n-FILES = gitweb.cgi\n+FILES = gitweb.cgi gitweb_defaults.pl\n \n .PHONY: $(FILES)\n \ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 3b44371..fd41539 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -36,466 +36,67 @@ our $version = \"++GIT_VERSION++\";\n our $my_url = $cgi->url();\n our $my_uri = $cgi->url(-absolute => 1);\n \n-# Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n-# needed and used only for URLs with nonempty PATH_INFO\n-our $base_url = $my_url;\n-\n-# When the script is used as DirectoryIndex, the URL does not contain the name\n-# of the script file itself, and $cgi->url() fails to strip PATH_INFO, so we\n-# have to do it ourselves. We make $path_info global because it's also used\n-# later on.\n #\n-# Another issue with the script being the DirectoryIndex is that the resulting\n-# $my_url data is not the full script URL: this is good, because we want\n-# generated links to keep implying the script name if it wasn't explicitly\n-# indicated in the URL we're handling, but it means that $my_url cannot be used\n-# as base URL.\n-# Therefore, if we needed to strip PATH_INFO, then we know that we have\n-# to build the base URL ourselves:\n-our $path_info = $ENV{\"PATH_INFO\"};\n-if ($path_info) {\n-\tif ($my_url =~ s,\\Q$path_info\\E$,, &&\n-\t    $my_uri =~ s,\\Q$path_info\\E$,, &&\n-\t    defined $ENV{'SCRIPT_NAME'}) {\n-\t\t$base_url = $cgi->url(-base => 1) . $ENV{'SCRIPT_NAME'};\n-\t}\n-}\n-\n-# core git executable to use\n-# this can just be \"git\" if your webserver has a sensible PATH\n-our $GIT = \"++GIT_BINDIR++/git\";\n-\n-# absolute fs-path which will be prepended to the project path\n-#our $projectroot = \"/pub/scm\";\n-our $projectroot = \"++GITWEB_PROJECTROOT++\";\n-\n-# fs traversing limit for getting project list\n-# the number is relative to the projectroot\n-our $project_maxdepth = \"++GITWEB_PROJECT_MAXDEPTH++\";\n-\n-# target of the home link on top of all pages\n-our $home_link = $my_uri || \"/\";\n-\n-# string of the home link on top of all pages\n-our $home_link_str = \"++GITWEB_HOME_LINK_STR++\";\n-\n-# name of your site or organization to appear in page titles\n-# replace this with something more descriptive for clearer bookmarks\n-our $site_name = \"++GITWEB_SITENAME++\"\n-                 || ($ENV{'SERVER_NAME'} || \"Untitled\") . \" Git\";\n-\n-# filename of html text to include at top of each page\n-our $site_header = \"++GITWEB_SITE_HEADER++\";\n-# html text to include at home page\n-our $home_text = \"++GITWEB_HOMETEXT++\";\n-# filename of html text to include at bottom of each page\n-our $site_footer = \"++GITWEB_SITE_FOOTER++\";\n-\n-# URI of stylesheets\n-our @stylesheets = (\"++GITWEB_CSS++\");\n-# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.\n-our $stylesheet = undef;\n-# URI of GIT logo (72x27 size)\n-our $logo = \"++GITWEB_LOGO++\";\n-# URI of GIT favicon, assumed to be image/png type\n-our $favicon = \"++GITWEB_FAVICON++\";\n-# URI of gitweb.js (JavaScript code for gitweb)\n-our $javascript = \"++GITWEB_JS++\";\n-\n-# URI and label (title) of GIT logo link\n-#our $logo_url = \"http://www.kernel.org/pub/software/scm/git/docs/\";\n-#our $logo_label = \"git documentation\";\n-our $logo_url = \"http://git-scm.com/\";\n-our $logo_label = \"git homepage\";\n-\n-# source of projects list\n-our $projects_list = \"++GITWEB_LIST++\";\n-\n-# the width (in characters) of the projects list \"Description\" column\n-our $projects_list_description_width = 25;\n-\n-# default order of projects list\n-# valid values are none, project, descr, owner, and age\n-our $default_projects_order = \"project\";\n-\n-# show repository only if this file exists\n-# (only effective if this variable evaluates to true)\n-our $export_ok = \"++GITWEB_EXPORT_OK++\";\n-\n-# show repository only if this subroutine returns true\n-# when given the path to the project, for example:\n-#    sub { return -e \"$_[0]/git-daemon-export-ok\"; }\n-our $export_auth_hook = undef;\n-\n-# only allow viewing of repositories also shown on the overview page\n-our $strict_export = \"++GITWEB_STRICT_EXPORT++\";\n-\n-# list of git base URLs used for URL to where fetch project from,\n-# i.e. full URL is \"$git_base_url/$project\"\n-our @git_base_url_list = grep { $_ ne '' } (\"++GITWEB_BASE_URL++\");\n-\n-# default blob_plain mimetype and default charset for text/plain blob\n-our $default_blob_plain_mimetype = 'text/plain';\n-our $default_text_plain_charset  = undef;\n-\n-# file to use for guessing MIME types before trying /etc/mime.types\n-# (relative to the current git repository)\n-our $mimetypes_file = undef;\n-\n-# assume this charset if line contains non-UTF-8 characters;\n-# it should be valid encoding (see Encoding::Supported(3pm) for list),\n-# for which encoding all byte sequences are valid, for example\n-# 'iso-8859-1' aka 'latin1' (it is decoded without checking, so it\n-# could be even 'utf-8' for the old behavior)\n-our $fallback_encoding = 'latin1';\n-\n-# rename detection options for git-diff and git-diff-tree\n-# - default is '-M', with the cost proportional to\n-#   (number of removed files) * (number of new files).\n-# - more costly is '-C' (which implies '-M'), with the cost proportional to\n-#   (number of changed files + number of removed files) * (number of new files)\n-# - even more costly is '-C', '--find-copies-harder' with cost\n-#   (number of files in the original tree) * (number of new files)\n-# - one might want to include '-B' option, e.g. '-B', '-M'\n-our @diff_opts = ('-M'); # taken from git_commit\n-\n-# Disables features that would allow repository owners to inject script into\n-# the gitweb domain.\n-our $prevent_xss = 0;\n-\n-# information about snapshot formats that gitweb is capable of serving\n-our %known_snapshot_formats = (\n-\t# name => {\n-\t# \t'display' => display name,\n-\t# \t'type' => mime type,\n-\t# \t'suffix' => filename suffix,\n-\t# \t'format' => --format for git-archive,\n-\t# \t'compressor' => [compressor command and arguments]\n-\t# \t                (array reference, optional)\n-\t# \t'disabled' => boolean (optional)}\n-\t#\n-\t'tgz' => {\n-\t\t'display' => 'tar.gz',\n-\t\t'type' => 'application/x-gzip',\n-\t\t'suffix' => '.tar.gz',\n-\t\t'format' => 'tar',\n-\t\t'compressor' => ['gzip']},\n-\n-\t'tbz2' => {\n-\t\t'display' => 'tar.bz2',\n-\t\t'type' => 'application/x-bzip2',\n-\t\t'suffix' => '.tar.bz2',\n-\t\t'format' => 'tar',\n-\t\t'compressor' => ['bzip2']},\n-\n-\t'txz' => {\n-\t\t'display' => 'tar.xz',\n-\t\t'type' => 'application/x-xz',\n-\t\t'suffix' => '.tar.xz',\n-\t\t'format' => 'tar',\n-\t\t'compressor' => ['xz'],\n-\t\t'disabled' => 1},\n-\n-\t'zip' => {\n-\t\t'display' => 'zip',\n-\t\t'type' => 'application/x-zip',\n-\t\t'suffix' => '.zip',\n-\t\t'format' => 'zip'},\n-);\n-\n-# Aliases so we understand old gitweb.snapshot values in repository\n-# configuration.\n-our %known_snapshot_format_aliases = (\n-\t'gzip'  => 'tgz',\n-\t'bzip2' => 'tbz2',\n-\t'xz'    => 'txz',\n-\n-\t# backward compatibility: legacy gitweb config support\n-\t'x-gzip' => undef, 'gz' => undef,\n-\t'x-bzip2' => undef, 'bz2' => undef,\n-\t'x-zip' => undef, '' => undef,\n-);\n-\n-# Pixel sizes for icons and avatars. If the default font sizes or lineheights\n-# are changed, it may be appropriate to change these values too via\n-# $GITWEB_CONFIG.\n-our %avatar_size = (\n-\t'default' => 16,\n-\t'double'  => 32\n+# Define and than setup our configuration \n+#\n+our(\n+\t$VERSION,\n+\t$path_info,\n+\t$GIT,\n+\t$projectroot,\n+\t$project_maxdepth,\n+\t$home_link,\n+\t$home_link_str,\n+\t$site_name,\n+\t$site_header,\n+\t$home_text,\n+\t$site_footer,\n+\t@stylesheets,\n+\t$stylesheet,\n+\t$logo,\n+\t$favicon,\n+\t$javascript,\n+\t$logo_url,\n+\t$logo_label,\n+\t$projects_list,\n+\t$projects_list_description_width,\n+\t$default_projects_order,\n+\t$export_ok,\n+\t$export_auth_hook,\n+\t$strict_export,\n+\t@git_base_url_list,\n+\t$default_blob_plain_mimetype,\n+\t$default_text_plain_charset,\n+\t$mimetypes_file,\n+\t$missmatch_git,\n+\t$gitlinkurl,\n+\t$maxload,\n+\t$cache_enable,\n+\t$minCacheTime,\n+\t$maxCacheTime,\n+\t$cachedir,\n+\t$backgroundCache,\n+\t$nocachedata,\n+\t$nocachedatabin,\n+\t$fullhashpath,\n+\t$fullhashbinpath,\n+\t$export_auth_hook,\n+\t%known_snapshot_format_aliases,\n+\t%known_snapshot_formats,\n+\t$path_info,\n+\t$fallback_encoding,\n+\t%avatar_size,\n+\t$project_maxdepth,\n+\t$headerRefresh,\n+\t$base_url,\n+\t$projects_list_description_width,\n+\t$default_projects_order,\n+\t$prevent_xss,\n+\t@diff_opts,\n+\t%feature\n );\n \n-# This is here to allow for missmatch git & gitweb versions\n-our $missmatch_git = '';\n-\n-#This is here to deal with an extra link on the summary pages - if it's left blank\n-# this link will not be shwon.  If it's set, this will be prepended to the repo and used\n-our $gitlinkurl = '';\n-\n-# Used to set the maximum load that we will still respond to gitweb queries.\n-# if we exceed this than we do the processing to figure out if there's a mirror\n-# and redirect to it, or to just return 503 server busy\n-our $maxload = 300;\n-\n-# This enables/disables the caching layer in gitweb.  This currently only supports the\n-# 'dumb' file based caching layer, primarily used on git.kernel.org.  this is reasonably\n-# effective but it has the downside of requiring a huge amount of disk space if there\n-# are a number of repositories involved.  It is not uncommon for git.kernel.org to have\n-# on the order of 80G - 120G accumulate over the course of a few months.  It is recommended\n-# that the cache directory be periodically completely deleted, and this is safe to perform.\n-# Suggested mechanism\n-# mv $cacheidr $cachedir.flush;mkdir $cachedir;rm -rf $cachedir.flush\n-# Value is binary. 0 = disabled (default), 1 = enabled.\n-our $cache_enable = 0;\n-\n-# Used to set the minimum cache timeout for the dynamic caching algorithm.  Basically\n-# if we calculate the cache to be under this number of seconds we set the cache timeout \n-# to this minimum.\n-# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n-our $minCacheTime = 20;\n-\n-# Used to set the maximum cache timeout for the dynamic caching algorithm.  Basically\n-# if we calculate the cache to exceed this number of seconds we set the cache timeout \n-# to this maximum.\n-# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n-our $maxCacheTime = 1200;\n-\n-# If you need to change the location of the caching directory, override this\n-# otherwise this will probably do fine for you\n-our $cachedir = 'cache';\n-\n-# If this is set (to 1) cache will do it's best to always display something instead\n-# of making someone wait for the cache to update.  This will launch the cacheUpdate\n-# into the background and it will lock a <file>.bg file and will only lock the \n-# actual cache file when it needs to write into it.  In theory this will make \n-# gitweb seem more responsive at the price of possibly stale data.\n-our $backgroundCache = 1;\n-\n-# Used to set the maximum cache file life.  If a cache files last modify time exceeds\n-# this value, it will assume that the data is just too old, and HAS to be regenerated\n-# instead of trying to display the existing cache data.\n-# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n-# 18000 = 5 hours\n-our $maxCacheLife = 18000;\n-\n-# You define site-wide feature defaults here; override them with\n-# $GITWEB_CONFIG as necessary.\n-our %feature = (\n-\t# feature => {\n-\t# \t'sub' => feature-sub (subroutine),\n-\t# \t'override' => allow-override (boolean),\n-\t# \t'default' => [ default options...] (array reference)}\n-\t#\n-\t# if feature is overridable (it means that allow-override has true value),\n-\t# then feature-sub will be called with default options as parameters;\n-\t# return value of feature-sub indicates if to enable specified feature\n-\t#\n-\t# if there is no 'sub' key (no feature-sub), then feature cannot be\n-\t# overriden\n-\t#\n-\t# use gitweb_get_feature(<feature>) to retrieve the <feature> value\n-\t# (an array) or gitweb_check_feature(<feature>) to check if <feature>\n-\t# is enabled\n-\n-\t# Enable the 'blame' blob view, showing the last commit that modified\n-\t# each line in the file. This can be very CPU-intensive.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'blame'}{'default'} = [1];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'blame'}{'override'} = 1;\n-\t# and in project config gitweb.blame = 0|1;\n-\t'blame' => {\n-\t\t'sub' => sub { feature_bool('blame', @_) },\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-\n-\t# Enable the 'snapshot' link, providing a compressed archive of any\n-\t# tree. This can potentially generate high traffic if you have large\n-\t# project.\n-\n-\t# Value is a list of formats defined in %known_snapshot_formats that\n-\t# you wish to offer.\n-\t# To disable system wide have in $GITWEB_CONFIG\n-\t# $feature{'snapshot'}{'default'} = [];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'snapshot'}{'override'} = 1;\n-\t# and in project config, a comma-separated list of formats or \"none\"\n-\t# to disable.  Example: gitweb.snapshot = tbz2,zip;\n-\t'snapshot' => {\n-\t\t'sub' => \\&feature_snapshot,\n-\t\t'override' => 0,\n-\t\t'default' => ['tgz']},\n-\n-\t# Enable text search, which will list the commits which match author,\n-\t# committer or commit text to a given string.  Enabled by default.\n-\t# Project specific override is not supported.\n-\t'search' => {\n-\t\t'override' => 0,\n-\t\t'default' => [1]},\n-\n-\t# Enable grep search, which will list the files in currently selected\n-\t# tree containing the given string. Enabled by default. This can be\n-\t# potentially CPU-intensive, of course.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'grep'}{'default'} = [1];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'grep'}{'override'} = 1;\n-\t# and in project config gitweb.grep = 0|1;\n-\t'grep' => {\n-\t\t'sub' => sub { feature_bool('grep', @_) },\n-\t\t'override' => 0,\n-\t\t'default' => [1]},\n-\n-\t# Enable the pickaxe search, which will list the commits that modified\n-\t# a given string in a file. This can be practical and quite faster\n-\t# alternative to 'blame', but still potentially CPU-intensive.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'pickaxe'}{'default'} = [1];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'pickaxe'}{'override'} = 1;\n-\t# and in project config gitweb.pickaxe = 0|1;\n-\t'pickaxe' => {\n-\t\t'sub' => sub { feature_bool('pickaxe', @_) },\n-\t\t'override' => 0,\n-\t\t'default' => [1]},\n-\n-\t# Enable showing size of blobs in a 'tree' view, in a separate\n-\t# column, similar to what 'ls -l' does.  This cost a bit of IO.\n-\n-\t# To disable system wide have in $GITWEB_CONFIG\n-\t# $feature{'show-sizes'}{'default'} = [0];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'show-sizes'}{'override'} = 1;\n-\t# and in project config gitweb.showsizes = 0|1;\n-\t'show-sizes' => {\n-\t\t'sub' => sub { feature_bool('showsizes', @_) },\n-\t\t'override' => 0,\n-\t\t'default' => [1]},\n-\n-\t# Make gitweb use an alternative format of the URLs which can be\n-\t# more readable and natural-looking: project name is embedded\n-\t# directly in the path and the query string contains other\n-\t# auxiliary information. All gitweb installations recognize\n-\t# URL in either format; this configures in which formats gitweb\n-\t# generates links.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'pathinfo'}{'default'} = [1];\n-\t# Project specific override is not supported.\n-\n-\t# Note that you will need to change the default location of CSS,\n-\t# favicon, logo and possibly other files to an absolute URL. Also,\n-\t# if gitweb.cgi serves as your indexfile, you will need to force\n-\t# $my_uri to contain the script name in your $GITWEB_CONFIG.\n-\t'pathinfo' => {\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-\n-\t# Make gitweb consider projects in project root subdirectories\n-\t# to be forks of existing projects. Given project $projname.git,\n-\t# projects matching $projname/*.git will not be shown in the main\n-\t# projects list, instead a '+' mark will be added to $projname\n-\t# there and a 'forks' view will be enabled for the project, listing\n-\t# all the forks. If project list is taken from a file, forks have\n-\t# to be listed after the main project.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'forks'}{'default'} = [1];\n-\t# Project specific override is not supported.\n-\t'forks' => {\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-\n-\t# Insert custom links to the action bar of all project pages.\n-\t# This enables you mainly to link to third-party scripts integrating\n-\t# into gitweb; e.g. git-browser for graphical history representation\n-\t# or custom web-based repository administration interface.\n-\n-\t# The 'default' value consists of a list of triplets in the form\n-\t# (label, link, position) where position is the label after which\n-\t# to insert the link and link is a format string where %n expands\n-\t# to the project name, %f to the project path within the filesystem,\n-\t# %h to the current hash (h gitweb parameter) and %b to the current\n-\t# hash base (hb gitweb parameter); %% expands to %.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG e.g.\n-\t# $feature{'actions'}{'default'} = [('graphiclog',\n-\t# \t'/git-browser/by-commit.html?r=%n', 'summary')];\n-\t# Project specific override is not supported.\n-\t'actions' => {\n-\t\t'override' => 0,\n-\t\t'default' => []},\n-\n-\t# Allow gitweb scan project content tags described in ctags/\n-\t# of project repository, and display the popular Web 2.0-ish\n-\t# \"tag cloud\" near the project list. Note that this is something\n-\t# COMPLETELY different from the normal Git tags.\n-\n-\t# gitweb by itself can show existing tags, but it does not handle\n-\t# tagging itself; you need an external application for that.\n-\t# For an example script, check Girocco's cgi/tagproj.cgi.\n-\t# You may want to install the HTML::TagCloud Perl module to get\n-\t# a pretty tag cloud instead of just a list of tags.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'ctags'}{'default'} = ['path_to_tag_script'];\n-\t# Project specific override is not supported.\n-\t'ctags' => {\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-\n-\t# The maximum number of patches in a patchset generated in patch\n-\t# view. Set this to 0 or undef to disable patch view, or to a\n-\t# negative number to remove any limit.\n-\n-\t# To disable system wide have in $GITWEB_CONFIG\n-\t# $feature{'patches'}{'default'} = [0];\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'patches'}{'override'} = 1;\n-\t# and in project config gitweb.patches = 0|n;\n-\t# where n is the maximum number of patches allowed in a patchset.\n-\t'patches' => {\n-\t\t'sub' => \\&feature_patches,\n-\t\t'override' => 0,\n-\t\t'default' => [16]},\n-\n-\t# Avatar support. When this feature is enabled, views such as\n-\t# shortlog or commit will display an avatar associated with\n-\t# the email of the committer(s) and/or author(s).\n-\n-\t# Currently available providers are gravatar and picon.\n-\t# If an unknown provider is specified, the feature is disabled.\n-\n-\t# Gravatar depends on Digest::MD5.\n-\t# Picon currently relies on the indiana.edu database.\n-\n-\t# To enable system wide have in $GITWEB_CONFIG\n-\t# $feature{'avatar'}{'default'} = ['<provider>'];\n-\t# where <provider> is either gravatar or picon.\n-\t# To have project specific config enable override in $GITWEB_CONFIG\n-\t# $feature{'avatar'}{'override'} = 1;\n-\t# and in project config gitweb.avatar = <provider>;\n-\t'avatar' => {\n-\t\t'sub' => \\&feature_avatar,\n-\t\t'override' => 0,\n-\t\t'default' => ['']},\n-\n-\t# Enable displaying how much time and how many git commands\n-\t# it took to generate and display page.  Disabled by default.\n-\t# Project specific override is not supported.\n-\t'timed' => {\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-\n-\t# Enable turning some links into links to actions which require\n-\t# JavaScript to run (like 'blame_incremental').  Not enabled by\n-\t# default.  Project specific override is currently not supported.\n-\t'javascript-actions' => {\n-\t\t'override' => 0,\n-\t\t'default' => [0]},\n-);\n+do 'gitweb_defaults.pl';\n \n sub gitweb_get_feature {\n \tmy ($name) = @_;\ndiff --git a/gitweb/gitweb_defaults.perl b/gitweb/gitweb_defaults.perl\nnew file mode 100644\nindex 0000000..ede0daf\n--- /dev/null\n+++ b/gitweb/gitweb_defaults.perl\n@@ -0,0 +1,468 @@\n+# gitweb - simple web interface to track changes in git repositories\n+#\n+# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>\n+# (C) 2005, Christian Gierke\n+#\n+# This program is licensed under the GPLv2\n+\n+# Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n+# needed and used only for URLs with nonempty PATH_INFO\n+$base_url = $my_url;\n+\n+# When the script is used as DirectoryIndex, the URL does not contain the name\n+# of the script file itself, and $cgi->url() fails to strip PATH_INFO, so we\n+# have to do it ourselves. We make $path_info global because it's also used\n+# later on.\n+#\n+# Another issue with the script being the DirectoryIndex is that the resulting\n+# $my_url data is not the full script URL: this is good, because we want\n+# generated links to keep implying the script name if it wasn't explicitly\n+# indicated in the URL we're handling, but it means that $my_url cannot be used\n+# as base URL.\n+# Therefore, if we needed to strip PATH_INFO, then we know that we have\n+# to build the base URL ourselves:\n+$path_info = $ENV{\"PATH_INFO\"};\n+if ($path_info) {\n+\tif ($my_url =~ s,\\Q$path_info\\E$,, &&\n+\t    $my_uri =~ s,\\Q$path_info\\E$,, &&\n+\t    defined $ENV{'SCRIPT_NAME'}) {\n+\t\t$base_url = $cgi->url(-base => 1) . $ENV{'SCRIPT_NAME'};\n+\t}\n+}\n+\n+# core git executable to use\n+# this can just be \"git\" if your webserver has a sensible PATH\n+$GIT = \"++GIT_BINDIR++/git\";\n+\n+# absolute fs-path which will be prepended to the project path\n+#our $projectroot = \"/pub/scm\";\n+$projectroot = \"++GITWEB_PROJECTROOT++\";\n+\n+# fs traversing limit for getting project list\n+# the number is relative to the projectroot\n+$project_maxdepth = \"++GITWEB_PROJECT_MAXDEPTH++\";\n+\n+# target of the home link on top of all pages\n+$home_link = $my_uri || \"/\";\n+\n+# string of the home link on top of all pages\n+$home_link_str = \"++GITWEB_HOME_LINK_STR++\";\n+\n+# name of your site or organization to appear in page titles\n+# replace this with something more descriptive for clearer bookmarks\n+$site_name = \"++GITWEB_SITENAME++\"\n+                 || ($ENV{'SERVER_NAME'} || \"Untitled\") . \" Git\";\n+\n+# filename of html text to include at top of each page\n+$site_header = \"++GITWEB_SITE_HEADER++\";\n+# html text to include at home page\n+$home_text = \"++GITWEB_HOMETEXT++\";\n+# filename of html text to include at bottom of each page\n+$site_footer = \"++GITWEB_SITE_FOOTER++\";\n+\n+# URI of stylesheets\n+@stylesheets = (\"++GITWEB_CSS++\");\n+# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.\n+$stylesheet = undef;\n+# URI of GIT logo (72x27 size)\n+$logo = \"++GITWEB_LOGO++\";\n+# URI of GIT favicon, assumed to be image/png type\n+$favicon = \"++GITWEB_FAVICON++\";\n+# URI of gitweb.js (JavaScript code for gitweb)\n+$javascript = \"++GITWEB_JS++\";\n+\n+# URI and label (title) of GIT logo link\n+#our $logo_url = \"http://www.kernel.org/pub/software/scm/git/docs/\";\n+#our $logo_label = \"git documentation\";\n+$logo_url = \"http://git-scm.com/\";\n+$logo_label = \"git homepage\";\n+\n+# source of projects list\n+$projects_list = \"++GITWEB_LIST++\";\n+\n+# the width (in characters) of the projects list \"Description\" column\n+$projects_list_description_width = 25;\n+\n+# default order of projects list\n+# valid values are none, project, descr, owner, and age\n+$default_projects_order = \"project\";\n+\n+# show repository only if this file exists\n+# (only effective if this variable evaluates to true)\n+$export_ok = \"++GITWEB_EXPORT_OK++\";\n+\n+# show repository only if this subroutine returns true\n+# when given the path to the project, for example:\n+#    sub { return -e \"$_[0]/git-daemon-export-ok\"; }\n+$export_auth_hook = undef;\n+\n+# only allow viewing of repositories also shown on the overview page\n+$strict_export = \"++GITWEB_STRICT_EXPORT++\";\n+\n+# list of git base URLs used for URL to where fetch project from,\n+# i.e. full URL is \"$git_base_url/$project\"\n+@git_base_url_list = grep { $_ ne '' } (\"++GITWEB_BASE_URL++\");\n+\n+# default blob_plain mimetype and default charset for text/plain blob\n+$default_blob_plain_mimetype = 'text/plain';\n+$default_text_plain_charset  = undef;\n+\n+# file to use for guessing MIME types before trying /etc/mime.types\n+# (relative to the current git repository)\n+$mimetypes_file = undef;\n+\n+# assume this charset if line contains non-UTF-8 characters;\n+# it should be valid encoding (see Encoding::Supported(3pm) for list),\n+# for which encoding all byte sequences are valid, for example\n+# 'iso-8859-1' aka 'latin1' (it is decoded without checking, so it\n+# could be even 'utf-8' for the old behavior)\n+$fallback_encoding = 'latin1';\n+\n+# rename detection options for git-diff and git-diff-tree\n+# - default is '-M', with the cost proportional to\n+#   (number of removed files) * (number of new files).\n+# - more costly is '-C' (which implies '-M'), with the cost proportional to\n+#   (number of changed files + number of removed files) * (number of new files)\n+# - even more costly is '-C', '--find-copies-harder' with cost\n+#   (number of files in the original tree) * (number of new files)\n+# - one might want to include '-B' option, e.g. '-B', '-M'\n+@diff_opts = ('-M'); # taken from git_commit\n+\n+# Disables features that would allow repository owners to inject script into\n+# the gitweb domain.\n+$prevent_xss = 0;\n+\n+# information about snapshot formats that gitweb is capable of serving\n+%known_snapshot_formats = (\n+\t# name => {\n+\t# \t'display' => display name,\n+\t# \t'type' => mime type,\n+\t# \t'suffix' => filename suffix,\n+\t# \t'format' => --format for git-archive,\n+\t# \t'compressor' => [compressor command and arguments]\n+\t# \t                (array reference, optional)\n+\t# \t'disabled' => boolean (optional)}\n+\t#\n+\t'tgz' => {\n+\t\t'display' => 'tar.gz',\n+\t\t'type' => 'application/x-gzip',\n+\t\t'suffix' => '.tar.gz',\n+\t\t'format' => 'tar',\n+\t\t'compressor' => ['gzip']},\n+\n+\t'tbz2' => {\n+\t\t'display' => 'tar.bz2',\n+\t\t'type' => 'application/x-bzip2',\n+\t\t'suffix' => '.tar.bz2',\n+\t\t'format' => 'tar',\n+\t\t'compressor' => ['bzip2']},\n+\n+\t'txz' => {\n+\t\t'display' => 'tar.xz',\n+\t\t'type' => 'application/x-xz',\n+\t\t'suffix' => '.tar.xz',\n+\t\t'format' => 'tar',\n+\t\t'compressor' => ['xz'],\n+\t\t'disabled' => 1},\n+\n+\t'zip' => {\n+\t\t'display' => 'zip',\n+\t\t'type' => 'application/x-zip',\n+\t\t'suffix' => '.zip',\n+\t\t'format' => 'zip'},\n+);\n+\n+# Aliases so we understand old gitweb.snapshot values in repository\n+# configuration.\n+%known_snapshot_format_aliases = (\n+\t'gzip'  => 'tgz',\n+\t'bzip2' => 'tbz2',\n+\t'xz'    => 'txz',\n+\n+\t# backward compatibility: legacy gitweb config support\n+\t'x-gzip' => undef, 'gz' => undef,\n+\t'x-bzip2' => undef, 'bz2' => undef,\n+\t'x-zip' => undef, '' => undef,\n+);\n+\n+# Pixel sizes for icons and avatars. If the default font sizes or lineheights\n+# are changed, it may be appropriate to change these values too via\n+# $GITWEB_CONFIG.\n+%avatar_size = (\n+\t'default' => 16,\n+\t'double'  => 32\n+);\n+\n+# This is here to allow for missmatch git & gitweb versions\n+$missmatch_git = '';\n+\n+#This is here to deal with an extra link on the summary pages - if it's left blank\n+# this link will not be shwon.  If it's set, this will be prepended to the repo and used\n+$gitlinkurl = '';\n+\n+# Used to set the maximum load that we will still respond to gitweb queries.\n+# if we exceed this than we do the processing to figure out if there's a mirror\n+# and redirect to it, or to just return 503 server busy\n+$maxload = 300;\n+\n+# This enables/disables the caching layer in gitweb.  This currently only supports the\n+# 'dumb' file based caching layer, primarily used on git.kernel.org.  this is reasonably\n+# effective but it has the downside of requiring a huge amount of disk space if there\n+# are a number of repositories involved.  It is not uncommon for git.kernel.org to have\n+# on the order of 80G - 120G accumulate over the course of a few months.  It is recommended\n+# that the cache directory be periodically completely deleted, and this is safe to perform.\n+# Suggested mechanism\n+# mv $cacheidr $cachedir.flush;mkdir $cachedir;rm -rf $cachedir.flush\n+# Value is binary. 0 = disabled (default), 1 = enabled.\n+$cache_enable = 0;\n+\n+# Used to set the minimum cache timeout for the dynamic caching algorithm.  Basically\n+# if we calculate the cache to be under this number of seconds we set the cache timeout \n+# to this minimum.\n+# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n+$minCacheTime = 20;\n+\n+# Used to set the maximum cache timeout for the dynamic caching algorithm.  Basically\n+# if we calculate the cache to exceed this number of seconds we set the cache timeout \n+# to this maximum.\n+# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n+$maxCacheTime = 1200;\n+\n+# If you need to change the location of the caching directory, override this\n+# otherwise this will probably do fine for you\n+$cachedir = 'cache';\n+\n+# If this is set (to 1) cache will do it's best to always display something instead\n+# of making someone wait for the cache to update.  This will launch the cacheUpdate\n+# into the background and it will lock a <file>.bg file and will only lock the \n+# actual cache file when it needs to write into it.  In theory this will make \n+# gitweb seem more responsive at the price of possibly stale data.\n+$backgroundCache = 1;\n+\n+# Used to set the maximum cache file life.  If a cache files last modify time exceeds\n+# this value, it will assume that the data is just too old, and HAS to be regenerated\n+# instead of trying to display the existing cache data.\n+# Value is in seconds.  1 = 1 seconds, 60 = 1 minute, 600 = 10 minutes, 3600 = 1 hour\n+# 18000 = 5 hours\n+$maxCacheLife = 18000;\n+\n+# You define site-wide feature defaults here; override them with\n+# $GITWEB_CONFIG as necessary.\n+%feature = (\n+\t# feature => {\n+\t# \t'sub' => feature-sub (subroutine),\n+\t# \t'override' => allow-override (boolean),\n+\t# \t'default' => [ default options...] (array reference)}\n+\t#\n+\t# if feature is overridable (it means that allow-override has true value),\n+\t# then feature-sub will be called with default options as parameters;\n+\t# return value of feature-sub indicates if to enable specified feature\n+\t#\n+\t# if there is no 'sub' key (no feature-sub), then feature cannot be\n+\t# overriden\n+\t#\n+\t# use gitweb_get_feature(<feature>) to retrieve the <feature> value\n+\t# (an array) or gitweb_check_feature(<feature>) to check if <feature>\n+\t# is enabled\n+\n+\t# Enable the 'blame' blob view, showing the last commit that modified\n+\t# each line in the file. This can be very CPU-intensive.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'blame'}{'default'} = [1];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'blame'}{'override'} = 1;\n+\t# and in project config gitweb.blame = 0|1;\n+\t'blame' => {\n+\t\t'sub' => sub { feature_bool('blame', @_) },\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+\n+\t# Enable the 'snapshot' link, providing a compressed archive of any\n+\t# tree. This can potentially generate high traffic if you have large\n+\t# project.\n+\n+\t# Value is a list of formats defined in %known_snapshot_formats that\n+\t# you wish to offer.\n+\t# To disable system wide have in $GITWEB_CONFIG\n+\t# $feature{'snapshot'}{'default'} = [];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'snapshot'}{'override'} = 1;\n+\t# and in project config, a comma-separated list of formats or \"none\"\n+\t# to disable.  Example: gitweb.snapshot = tbz2,zip;\n+\t'snapshot' => {\n+\t\t'sub' => \\&feature_snapshot,\n+\t\t'override' => 0,\n+\t\t'default' => ['tgz']},\n+\n+\t# Enable text search, which will list the commits which match author,\n+\t# committer or commit text to a given string.  Enabled by default.\n+\t# Project specific override is not supported.\n+\t'search' => {\n+\t\t'override' => 0,\n+\t\t'default' => [1]},\n+\n+\t# Enable grep search, which will list the files in currently selected\n+\t# tree containing the given string. Enabled by default. This can be\n+\t# potentially CPU-intensive, of course.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'grep'}{'default'} = [1];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'grep'}{'override'} = 1;\n+\t# and in project config gitweb.grep = 0|1;\n+\t'grep' => {\n+\t\t'sub' => sub { feature_bool('grep', @_) },\n+\t\t'override' => 0,\n+\t\t'default' => [1]},\n+\n+\t# Enable the pickaxe search, which will list the commits that modified\n+\t# a given string in a file. This can be practical and quite faster\n+\t# alternative to 'blame', but still potentially CPU-intensive.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'pickaxe'}{'default'} = [1];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'pickaxe'}{'override'} = 1;\n+\t# and in project config gitweb.pickaxe = 0|1;\n+\t'pickaxe' => {\n+\t\t'sub' => sub { feature_bool('pickaxe', @_) },\n+\t\t'override' => 0,\n+\t\t'default' => [1]},\n+\n+\t# Enable showing size of blobs in a 'tree' view, in a separate\n+\t# column, similar to what 'ls -l' does.  This cost a bit of IO.\n+\n+\t# To disable system wide have in $GITWEB_CONFIG\n+\t# $feature{'show-sizes'}{'default'} = [0];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'show-sizes'}{'override'} = 1;\n+\t# and in project config gitweb.showsizes = 0|1;\n+\t'show-sizes' => {\n+\t\t'sub' => sub { feature_bool('showsizes', @_) },\n+\t\t'override' => 0,\n+\t\t'default' => [1]},\n+\n+\t# Make gitweb use an alternative format of the URLs which can be\n+\t# more readable and natural-looking: project name is embedded\n+\t# directly in the path and the query string contains other\n+\t# auxiliary information. All gitweb installations recognize\n+\t# URL in either format; this configures in which formats gitweb\n+\t# generates links.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'pathinfo'}{'default'} = [1];\n+\t# Project specific override is not supported.\n+\n+\t# Note that you will need to change the default location of CSS,\n+\t# favicon, logo and possibly other files to an absolute URL. Also,\n+\t# if gitweb.cgi serves as your indexfile, you will need to force\n+\t# $my_uri to contain the script name in your $GITWEB_CONFIG.\n+\t'pathinfo' => {\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+\n+\t# Make gitweb consider projects in project root subdirectories\n+\t# to be forks of existing projects. Given project $projname.git,\n+\t# projects matching $projname/*.git will not be shown in the main\n+\t# projects list, instead a '+' mark will be added to $projname\n+\t# there and a 'forks' view will be enabled for the project, listing\n+\t# all the forks. If project list is taken from a file, forks have\n+\t# to be listed after the main project.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'forks'}{'default'} = [1];\n+\t# Project specific override is not supported.\n+\t'forks' => {\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+\n+\t# Insert custom links to the action bar of all project pages.\n+\t# This enables you mainly to link to third-party scripts integrating\n+\t# into gitweb; e.g. git-browser for graphical history representation\n+\t# or custom web-based repository administration interface.\n+\n+\t# The 'default' value consists of a list of triplets in the form\n+\t# (label, link, position) where position is the label after which\n+\t# to insert the link and link is a format string where %n expands\n+\t# to the project name, %f to the project path within the filesystem,\n+\t# %h to the current hash (h gitweb parameter) and %b to the current\n+\t# hash base (hb gitweb parameter); %% expands to %.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG e.g.\n+\t# $feature{'actions'}{'default'} = [('graphiclog',\n+\t# \t'/git-browser/by-commit.html?r=%n', 'summary')];\n+\t# Project specific override is not supported.\n+\t'actions' => {\n+\t\t'override' => 0,\n+\t\t'default' => []},\n+\n+\t# Allow gitweb scan project content tags described in ctags/\n+\t# of project repository, and display the popular Web 2.0-ish\n+\t# \"tag cloud\" near the project list. Note that this is something\n+\t# COMPLETELY different from the normal Git tags.\n+\n+\t# gitweb by itself can show existing tags, but it does not handle\n+\t# tagging itself; you need an external application for that.\n+\t# For an example script, check Girocco's cgi/tagproj.cgi.\n+\t# You may want to install the HTML::TagCloud Perl module to get\n+\t# a pretty tag cloud instead of just a list of tags.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'ctags'}{'default'} = ['path_to_tag_script'];\n+\t# Project specific override is not supported.\n+\t'ctags' => {\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+\n+\t# The maximum number of patches in a patchset generated in patch\n+\t# view. Set this to 0 or undef to disable patch view, or to a\n+\t# negative number to remove any limit.\n+\n+\t# To disable system wide have in $GITWEB_CONFIG\n+\t# $feature{'patches'}{'default'} = [0];\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'patches'}{'override'} = 1;\n+\t# and in project config gitweb.patches = 0|n;\n+\t# where n is the maximum number of patches allowed in a patchset.\n+\t'patches' => {\n+\t\t'sub' => \\&feature_patches,\n+\t\t'override' => 0,\n+\t\t'default' => [16]},\n+\n+\t# Avatar support. When this feature is enabled, views such as\n+\t# shortlog or commit will display an avatar associated with\n+\t# the email of the committer(s) and/or author(s).\n+\n+\t# Currently available providers are gravatar and picon.\n+\t# If an unknown provider is specified, the feature is disabled.\n+\n+\t# Gravatar depends on Digest::MD5.\n+\t# Picon currently relies on the indiana.edu database.\n+\n+\t# To enable system wide have in $GITWEB_CONFIG\n+\t# $feature{'avatar'}{'default'} = ['<provider>'];\n+\t# where <provider> is either gravatar or picon.\n+\t# To have project specific config enable override in $GITWEB_CONFIG\n+\t# $feature{'avatar'}{'override'} = 1;\n+\t# and in project config gitweb.avatar = <provider>;\n+\t'avatar' => {\n+\t\t'sub' => \\&feature_avatar,\n+\t\t'override' => 0,\n+\t\t'default' => ['']},\n+\n+\t# Enable displaying how much time and how many git commands\n+\t# it took to generate and display page.  Disabled by default.\n+\t# Project specific override is not supported.\n+\t'timed' => {\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+\n+\t# Enable turning some links into links to actions which require\n+\t# JavaScript to run (like 'blame_incremental').  Not enabled by\n+\t# default.  Project specific override is currently not supported.\n+\t'javascript-actions' => {\n+\t\t'override' => 0,\n+\t\t'default' => [0]},\n+);\n+1;\n"},{"id":"129720","messageId":"fabb9a1e0912101553o1bc7dd0bk5b852985493b296f@mail.gmail.com","threadId":"21933","inReplyTo":"1260488743-25855-1-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 0/6] Gitweb caching changes v2","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-12-10T23:53:03Z","receivedAt":"2009-12-10T23:53:03Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Dec 11, 2009 at 00:45, John 'Warthog9' Hawley\n<warthog9@kernel.org> wrote:\n> John 'Warthog9' Hawley (6):\n>  GITWEB - Load Checking\n>  GITWEB - Missmatching git w/ gitweb\n>  GITWEB - Add git:// link to summary pages\n>  GITWEB - Makefile changes\n>  GITWEB - File based caching layer\n>  GITWEB - Separate defaults from main file\n\nI'd prefer not to be shouted at, how about s/GITWEB/gitweb: /g ? :)\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"129721","messageId":"fabb9a1e0912101554r5a8df316w19203894c9962c94@mail.gmail.com","threadId":"21933","inReplyTo":"1260488743-25855-2-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-12-10T23:54:04Z","receivedAt":"2009-12-10T23:54:04Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Dec 11, 2009 at 00:45, John 'Warthog9' Hawley\n<warthog9@kernel.org> wrote:\n>  gitweb/gitweb.perl |   24 ++++++++++++++++++++++++\n>  1 files changed, 24 insertions(+), 0 deletions(-)\n>\n>\n\nAlso, what happened to including patches inline for ease of review?\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"129725","messageId":"m34onye3h8.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-2-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T00:52:22Z","receivedAt":"2009-12-11T00:52:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n> This changes the behavior, slightly, of gitweb so that it verifies\n> that the box isn't inundated with before attempting to serve gitweb.\n> If the box is overloaded, it basically returns a 503 server unavailable\n> until the load falls below the defined threshold.  This helps dramatically\n> if you have a box that's I/O bound, reaches a certain load and you\n> don't want gitweb, the I/O hog that it is, increasing the pain the\n> server is already undergoing.\n> \n> adds $maxload configuration variable.  Default is a load of 300,\n> which for most cases should never be hit.\n\nYour patch doesn't allow for *turning off* this feature.  Reasonable\nsolution would be to use 'undef' or negative number to turn off this\ncheck (this feature).\n\n> \n> Please note this makes the assumption that /proc/loadavg exists\n> as there is no good way to read load averages on a great number of\n> platforms [READ: Windows], or that it's reasonably accurate.\n\nWhat about MacOS X, or FreeBSD, or OpenSolaris?\n\nYou should mention that it is intended that if gitweb cannot read load\naverage (for example /proc/loadavg does not exist), then the feature\nis turned off, i.e. the check always succeeds.  Which is reasonable.\n\n> \n> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n\nWhy signoff is different from author (warthog9@kernel.org)?  Why this\nemail for signoff?  Just curious...\n\n> ---\n>  gitweb/gitweb.perl |   24 ++++++++++++++++++++++++\n>  1 files changed, 24 insertions(+), 0 deletions(-) \n\nPlease post patches inline, not as attachement.\n\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 7e477af..813e48f 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -221,6 +221,11 @@ our %avatar_size = (\n>  \t'double'  => 32\n>  );\n>  \n> +# Used to set the maximum load that we will still respond to gitweb queries.\n> +# if we exceed this than we do the processing to figure out if there's a mirror\n> +# and redirect to it, or to just return 503 server busy\n\nI'd probably say:\n\n+# Used to set the maximum load that we will still respond to gitweb queries.\n+# If server load exceed this value then return \"503 server busy\" error,\n+# (it is also possible to redirect to mirror, if it exists, instead).\n\n> +our $maxload = 300;\n> +\n>  # You define site-wide feature defaults here; override them with\n>  # $GITWEB_CONFIG as necessary.\n>  our %feature = (\n> @@ -551,6 +556,25 @@ if (-e $GITWEB_CONFIG) {\n>  \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n>  }\n>  \n> +# loadavg throttle\n> +sub get_loadavg() {\n> +    my $load;\n> +    my @loads;\n> +\n> +    open($load, '<', '/proc/loadavg') or return 0;\n\nWhy not use one of existing CPAN modules: Sys::Info::Device::CPU,\nBSD::getloadavg, Sys::CpuLoad?\n\nStyle:\n\n+    open (my $load, '<', '/proc/loadavg') or return 0;\n\nand of course no \"my $load\" at beginning.  Also perhaps $fh, or\n$loadfh instead of $load?  But this is a minor nit.\n\n> +    @loads = split(/\\s+/, scalar <$load>);\n> +    close($load);\n> +    return $loads[0];\n> +}\n> +\n> +if (get_loadavg() > $maxload) {\n> +    print \"Content-Type: text/plain\\n\";\n> +    print \"Status: 503 Excessive load on server\\n\";\n> +    print \"\\n\";\n> +    print \"The load average on the server is too high\\n\";\n> +    exit 0;\n\nWhy not use die_error subroutine?  Is it to have generate absolutely\nminimal load, and that is why you do not use die_error(), or even\n$cgi->header()?\n\nWouldn't a better solution be to use here-doc syntax?\n\n+    print <<'EOF';\n+Content-Type: text/plain; charset=utf-8\n+Status: 503 Excessive load on server\n+\n+The load average on the server is too high\n+EOF\n+    exit 0;\n\n\n> +}\n> +\n>  # version of the core git binary\n>  our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n>  $number_of_git_cmds++;\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129726","messageId":"7v4ony8ge7.fsf@alter.siamese.dyndns.org","threadId":"21933","inReplyTo":"m34onye3h8.fsf@localhost.localdomain","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-11T01:10:24Z","receivedAt":"2009-12-11T01:10:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n>> +# loadavg throttle\n>> +sub get_loadavg() {\n>> +    my $load;\n>> +    my @loads;\n>> +\n>> +    open($load, '<', '/proc/loadavg') or return 0;\n>\n> Why not use one of existing CPAN modules: Sys::Info::Device::CPU,\n> BSD::getloadavg, Sys::CpuLoad?\n\nI would prefer to hear something along the lines of...\n\n    I like this.  Here is a follow-up patch you can squash in to\n    support other platforms.\n\nI gave the patches a cursory look (I somehow didn't see 5/6, though) and\nthey all looked decently done, except that some of the lines were\nexcessively long.\n"},{"id":"129729","messageId":"4B21AC4D.2020407@kernel.org","threadId":"21933","inReplyTo":"m34onye3h8.fsf@localhost.localdomain","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-11T02:19:57Z","receivedAt":"2009-12-11T02:19:57Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"<snip>\n>> adds $maxload configuration variable.  Default is a load of 300,\n>> which for most cases should never be hit.\n> \n> Your patch doesn't allow for *turning off* this feature.  Reasonable\n> solution would be to use 'undef' or negative number to turn off this\n> check (this feature).\n\nWell there's the opposite argument that setting the number arbitrarily \nhigh, 4096 for instance would also in essence negate this (though I'll \nadmit I've reached and exceeded those numbers before)\n\nThat said I agree, being able to turn this off needs to be added and \nwill be shortly.\n\n>> Please note this makes the assumption that /proc/loadavg exists\n>> as there is no good way to read load averages on a great number of\n>> platforms [READ: Windows], or that it's reasonably accurate.\n> \n> What about MacOS X, or FreeBSD, or OpenSolaris?\n\nWill comment on this further down\n\n> You should mention that it is intended that if gitweb cannot read load\n> average (for example /proc/loadavg does not exist), then the feature\n> is turned off, i.e. the check always succeeds.  Which is reasonable.\n\nThat's fine.\n\n> \n>> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n> \n> Why signoff is different from author (warthog9@kernel.org)?  Why this\n> email for signoff?  Just curious...\n\nMy bad, did the patches up on my laptop but had to send them out from \nkernel.org, thus the miss-match: I.E. user error.\n\n<snip>\n\n>> +# loadavg throttle\n>> +sub get_loadavg() {\n>> +    my $load;\n>> +    my @loads;\n>> +\n>> +    open($load, '<', '/proc/loadavg') or return 0;\n> \n> Why not use one of existing CPAN modules: Sys::Info::Device::CPU,\n> BSD::getloadavg, Sys::CpuLoad?\n\nHere's the fundamental problem:\n\nSys:Info:Device:CPU\n\tWindows:\n\t\tUsing this method under Windows is not recommended\n\t\tsince, the WMI interface will possibly take at least 2\n\t\tseconds to complete the request.\n\nBSD::getloadavg\n\tWhile this more or less supports anything with a libc getloadavg\n\t(and thus might be the best one I've seen, I'll admit I didn't\n\tnotice this one when I looked years ago) getting it to work on\n\twindows looks, exciting.\n\nSys::CpuLoad:\n\thttp://cpansearch.perl.org/src/CLINTDW/Sys-CpuLoad-0.03/README\n\tSpecifically:\n\t\t- Currently FreeBSD and OpenBSD are supported.\n\t\t- Wanted: HPUX 11.11 ...\n\t\t- Todo: Win32 support\n\n\tSo this doesn't really buy me anything but, maybe, BSD support.\n\t\nSo at the end of the day, none of those really gets me a \"useful\" cross \nplatform load checker (though like I said BSD::getloadavg looks to be \nthe best of the ones you mentioned) and more or less Windows is going to \nlose this as a usable feature no matter what.\n\nI think I'd almost rather set this up so that if it can't get something \nuseful (I.E. /proc/loadavg is missing) it just skips past it as if the \nload was 0.\n\nI might try out the BSD::getloadavg but I want to take a look and see if \nthat's easily installed or not, if it's not it might be difficult to \njustify that as a dependency.\n\n<snip>\n\n>> +if (get_loadavg() > $maxload) {\n>> +    print \"Content-Type: text/plain\\n\";\n>> +    print \"Status: 503 Excessive load on server\\n\";\n>> +    print \"\\n\";\n>> +    print \"The load average on the server is too high\\n\";\n>> +    exit 0;\n> \n> Why not use die_error subroutine?  Is it to have generate absolutely\n> minimal load, and that is why you do not use die_error(), or even\n> $cgi->header()?\n> \n> Wouldn't a better solution be to use here-doc syntax?\n> \n> +    print <<'EOF';\n> +Content-Type: text/plain; charset=utf-8\n> +Status: 503 Excessive load on server\n> +\n> +The load average on the server is too high\n> +EOF\n> +    exit 0;\n\nIt was intended to be the most minimal possible, mainly get in, get out. \n  Also not sure the die_error existed in gitweb when this was originally \nwritten.  Probably worth switching to it now since it's there either \nway, and I don't think using it would add enough overhead to matter.\n\n- John 'Warthog9' Hawley\n"},{"id":"129730","messageId":"7vk4wu6x6a.fsf@alter.siamese.dyndns.org","threadId":"21933","inReplyTo":"4B21AC4D.2020407@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-11T02:50:53Z","receivedAt":"2009-12-11T02:50:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"J.H.\" <warthog9@kernel.org> writes:\n\n> It was intended to be the most minimal possible, mainly get in, get\n> out. Also not sure the die_error existed in gitweb when this was\n> originally written.  Probably worth switching to it now since it's\n> there either way, and I don't think using it would add enough overhead\n> to matter.\n\nThanks; all sounded a reasonable response to the review.  Are you\nre-rolling the series anytime soon (I am asking because then I'd rather\nnot to queue this round especially because I didn't see 5/6).\n"},{"id":"129731","messageId":"4B21B550.1060806@kernel.org","threadId":"21933","inReplyTo":"7vk4wu6x6a.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-11T02:58:24Z","receivedAt":"2009-12-11T02:58:24Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"Junio C Hamano wrote:\n> \"J.H.\" <warthog9@kernel.org> writes:\n> \n>> It was intended to be the most minimal possible, mainly get in, get\n>> out. Also not sure the die_error existed in gitweb when this was\n>> originally written.  Probably worth switching to it now since it's\n>> there either way, and I don't think using it would add enough overhead\n>> to matter.\n> \n> Thanks; all sounded a reasonable response to the review.  Are you\n> re-rolling the series anytime soon (I am asking because then I'd rather\n> not to queue this round especially because I didn't see 5/6).\n\nI'll probably have some changes up and about tomorrow, and it's a little \ntroubling that 5/6 didn't come through for you\n\n6 at least made it to marc.info: \nhttp://marc.info/?l=git&m=126048884825985&w=2\n\nand 5 seems to have been eaten by a grue somewhere.  It was a *big* \npatch mainly because all the caching flips over in a single go.  If you \nwant I can privately bounce 5 & 6 to you so you have a complete tree \nright now?\n\n- John 'Warthog9' Hawley\n"},{"id":"129733","messageId":"4B21B786.3090000@eaglescrag.net","threadId":"21933","inReplyTo":"4B21B550.1060806@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"J.H.","fromEmail":"warthog19@eaglescrag.net","sentAt":"2009-12-11T03:07:50Z","receivedAt":"2009-12-11T03:07:50Z","isPatch":true,"sender":{"key":"warthog19@eaglescrag.net","avatar":null},"body":"J.H. wrote:\n> Junio C Hamano wrote:\n>> \"J.H.\" <warthog9@kernel.org> writes:\n>>\n>>> It was intended to be the most minimal possible, mainly get in, get\n>>> out. Also not sure the die_error existed in gitweb when this was\n>>> originally written.  Probably worth switching to it now since it's\n>>> there either way, and I don't think using it would add enough overhead\n>>> to matter.\n>>\n>> Thanks; all sounded a reasonable response to the review.  Are you\n>> re-rolling the series anytime soon (I am asking because then I'd rather\n>> not to queue this round especially because I didn't see 5/6).\n> \n> I'll probably have some changes up and about tomorrow, and it's a little \n> troubling that 5/6 didn't come through for you\n> \n> 6 at least made it to marc.info: \n> http://marc.info/?l=git&m=126048884825985&w=2\n> \n> and 5 seems to have been eaten by a grue somewhere.  It was a *big* \n> patch mainly because all the caching flips over in a single go.  If you \n> want I can privately bounce 5 & 6 to you so you have a complete tree \n> right now?\n\nNot to reply to myself but this might also be helpful:\n\nhttp://git.kernel.org/?p=git/warthog9/gitweb.git;a=shortlog;h=refs/heads/gitweb-ml-v2\n\n- John 'Warthog9' Hawley\n"},{"id":"129734","messageId":"7v7hsu6wap.fsf@alter.siamese.dyndns.org","threadId":"21933","inReplyTo":"4B21B550.1060806@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-11T03:09:50Z","receivedAt":"2009-12-11T03:09:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"J.H.\" <warthog9@kernel.org> writes:\n\n>> Thanks; all sounded a reasonable response to the review.  Are you\n>> re-rolling the series anytime soon (I am asking because then I'd rather\n>> not to queue this round especially because I didn't see 5/6).\n>\n> I'll probably have some changes up and about tomorrow, and it's a\n> little troubling that 5/6 didn't come through for you\n>\n> 6 at least made it to marc.info:\n> http://marc.info/?l=git&m=126048884825985&w=2\n\nSorry; I meant to say \"[PATCH 5/6]\", not \"5 and 6 didn't come\".\n\n> and 5 seems to have been eaten by a grue somewhere.  It was a *big*\n> patch mainly because all the caching flips over in a single go.  If\n> you want I can privately bounce 5 & 6 to you so you have a complete\n> tree right now?\n\nThanks, but not interested, in the sense that it wouldn't make much sense\nto me to have a version tonight that is known to go stale within a few\ndays.  I only pick up and queue patches to 'pu' to save me from later\ntrouble of finding them from the mailing list backlog, and not to actively\nreview and engage in the discussion to polish them right now.  We are\nalready deep in pre-release freeze and my attention is not currently on\nanything that won't go in to the upcoming release.\n\nI want to have a solid 1.6.6 before the holidays as a present to all ;-).\n"},{"id":"129738","messageId":"200912111109.17047.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B21AC4D.2020407@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T10:09:16Z","receivedAt":"2009-12-11T10:09:16Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 11 Dec 2009, J.H. wrote:\n> <snip>\n>>> adds $maxload configuration variable.  Default is a load of 300,\n>>> which for most cases should never be hit.\n>> \n>> Your patch doesn't allow for *turning off* this feature.  Reasonable\n>> solution would be to use 'undef' or negative number to turn off this\n>> check (this feature).\n> \n> Well there's the opposite argument that setting the number arbitrarily \n> high, 4096 for instance would also in essence negate this (though I'll \n> admit I've reached and exceeded those numbers before)\n> \n> That said I agree, being able to turn this off needs to be added and \n> will be shortly.\n\nSimplest solution would be to used 'undef' (undefined value) for \n\"turned off\", i.e.:\n\n  if (defined $maxload && get_loadavg() > $maxload) {\n\n>>> Please note this makes the assumption that /proc/loadavg exists\n>>> as there is no good way to read load averages on a great number of\n>>> platforms [READ: Windows], or that it's reasonably accurate.\n>> \n>> What about MacOS X, or FreeBSD, or OpenSolaris?\n> \n> Will comment on this further down\n\nI think it would be better to write in commit message that because finding\nload average is OS dependent, there is provided (sample) solution which\nuses /proc/loadavg and works (at least) on Linux.  And that for platforms\nwhich do not have /proc/loadavg the feature is simply turned off (by the\nway of using load=0 if load cannot be determined).\n \n>> You should mention that it is intended that if gitweb cannot read load\n>> average (for example /proc/loadavg does not exist), then the feature\n>> is turned off, i.e. the check always succeeds.  Which is reasonable.\n> \n> That's fine.\n\nSee above proposal.  This information should be present in commit message,\nand perhaps maybe even as one-line comment above opening /proc/loadavg.\n\n>>> +# loadavg throttle\n>>> +sub get_loadavg() {\n>>> +    my $load;\n>>> +    my @loads;\n>>> +\n>>> +    open($load, '<', '/proc/loadavg') or return 0;\n>> \n>> Why not use one of existing CPAN modules: Sys::Info::Device::CPU,\n>> BSD::getloadavg, Sys::CpuLoad?\n> \n> Here's the fundamental problem:\n> \n> Sys:Info:Device:CPU\n> \tWindows:\n> \t\tUsing this method under Windows is not recommended\n> \t\tsince, the WMI interface will possibly take at least 2\n> \t\tseconds to complete the request.\n> \n> BSD::getloadavg\n> \tWhile this more or less supports anything with a libc getloadavg\n> \t(and thus might be the best one I've seen, I'll admit I didn't\n> \tnotice this one when I looked years ago) getting it to work on\n> \twindows looks, exciting.\n> \n> Sys::CpuLoad:\n> \thttp://cpansearch.perl.org/src/CLINTDW/Sys-CpuLoad-0.03/README\n> \tSpecifically:\n> \t\t- Currently FreeBSD and OpenBSD are supported.\n> \t\t- Wanted: HPUX 11.11 ...\n> \t\t- Todo: Win32 support\n> \n> \tSo this doesn't really buy me anything but, maybe, BSD support.\n> \t\n> So at the end of the day, none of those really gets me a \"useful\" cross \n> platform load checker (though like I said BSD::getloadavg looks to be \n> the best of the ones you mentioned) and more or less Windows is going to \n> lose this as a usable feature no matter what.\n> \n> I think I'd almost rather set this up so that if it can't get something \n> useful (I.E. /proc/loadavg is missing) it just skips past it as if the \n> load was 0.\n> \n> I might try out the BSD::getloadavg but I want to take a look and see if \n> that's easily installed or not, if it's not it might be difficult to \n> justify that as a dependency.\n\nAfter thinking about this a bit, now I don't think that it is terribly\nimportant.  You *might* describe alternate approaches (roads not taken)\nin commit message, but requiring /proc/loadavg for the feature to work\nis fine for first patch (it makes patch simpler).\n\n>>> +if (get_loadavg()> $maxload) {\n>>> +    print \"Content-Type: text/plain\\n\";\n>>> +    print \"Status: 503 Excessive load on server\\n\";\n>>> +    print \"\\n\";\n>>> +    print \"The load average on the server is too high\\n\";\n>>> +    exit 0;\n>> \n>> Why not use die_error subroutine?  Is it to have generate absolutely\n>> minimal load, and that is why you do not use die_error(), or even\n>> $cgi->header()?\n>> \n>> Wouldn't a better solution be to use here-doc syntax?\n>> \n>> +    print <<'EOF';\n>> +Content-Type: text/plain; charset=utf-8\n>> +Status: 503 Excessive load on server\n>> +\n>> +The load average on the server is too high\n>> +EOF\n>> +    exit 0;\n> \n> It was intended to be the most minimal possible, mainly get in, get out. \n>\n>   Also not sure the die_error existed in gitweb when this was originally \n> written.  Probably worth switching to it now since it's there either \n> way, and I don't think using it would add enough overhead to matter.\n\nWell, if you are not worring excessively about overhead, then I think\nusing die_error would be the best solution, as it would preserve look\nof gitweb.  It would require extending die_error by 503 response, or\nrather %http_responses hash and comment above die_error.\n\nAlso I think that Status: should be before Content-Type: header (but\nprobably it is not required by the standard).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"129740","messageId":"m3y6l9dbop.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-3-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 2/6] GITWEB - Missmatching git w/ gitweb","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T10:52:43Z","receivedAt":"2009-12-11T10:52:43Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n> This adds $missmatch_git so that gitweb can run with a miss-matched\n> git install.  Gitweb, generally, runs fine on a very broad range of\n> git versions, but it's not always practicle or useful to upgrade it\n> every time you upgrade git.\n> \n> This allows the administrator to realize they are miss-matched, and\n> should they be so inclined, disable the check entirely and run in\n> a miss-matched fasion.\n> \n> This is more here to give an obvious warning as to whats going on\n> vs. silently failing.\n\nFirst, why one would want to require that gitweb version (version at\nthe time of build) and runtime git version (version of git used to run\ncommands) match?\n\nSecond, it is mismatch, not missmatch (one 's', not double 's').\n\nThird, in my opinion it would be better to name variable in question\ne.g. $versions_must_match and also flip its meaning (true means check\nthat versions match, and show an error otherwise).\n\n>\n> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n\nsignoff mismatch\n\n> ---\n>  gitweb/gitweb.perl |   22 ++++++++++++++++++++++\n>  1 files changed, 22 insertions(+), 0 deletions(-)\n> \n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 813e48f..d84f4c0 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -221,6 +221,9 @@ our %avatar_size = (\n>  \t'double'  => 32\n>  );\n>  \n> +# This is here to allow for missmatch git & gitweb versions\n> +our $missmatch_git = '';\n> +\n\nFirst, 'undef' is false, so it could have been written as\n\n+our $missmatch_git;\n\nOr if you prefer explicit false-ish value as default, 0 would be I\nthink better than empty string '':\n\n+our $missmatch_git = 0;\n\n\nSecond, there is question whether default should be to allow\nmismatched versions (current behaviour, more lenient...) or deny (or\nwarn about) mismatched version, i.e. should it be $versions_must_match\nfalse by default, or $allow_versions_mismatch false by default.\n\n>  # Used to set the maximum load that we will still respond to gitweb queries.\n>  # if we exceed this than we do the processing to figure out if there's a mirror\n>  # and redirect to it, or to just return 503 server busy\n> @@ -579,6 +582,25 @@ if (get_loadavg() > $maxload) {\n>  our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n>  $number_of_git_cmds++;\n>  \n> +# There's a pretty serious flaw that we silently fail if git doesn't find something it needs\n> +# a quick and simple check is to have gitweb do a simple check - are we running on the same\n> +# version of git that we shipped with - if not, throw up an error so that people doing\n> +# first installs don't have to debug perl to figure out whats going on\n\nCould you please clean up language in above comment?  It is very\nconvoluted.  Please also limit line width of above comment to 76 / 80\ncolumns.\n\n> +if (\n> +\t$git_version ne $version\n> +\t&&\n> +\t$missmatch_git eq ''\n> +){\n\nStyle\n\n+if (!$allow_versions_mismatch &&\n+    $git_version ne $version) {\n\nDo not compare $missmatch_git / $allow_versions_mismatch against '':\nit is a boolean value!\n\n> +\tgit_header_html();\n\nShouldn't this be \"500 Internal Server Error\" or something (using the\noptional parameter to git_header_html())?\n\n> +\tprint \"<p><b>*** Warning ***</b></p>\\n\";\n> +\tprint \"<p>\\n\";\n> +\tprint \"This version of gitweb was compiled for <b>$version</b> however git version <b>$git_version</b> was found<br/>\\n\";\n> +\tprint \"If you are sure this version of git works with this version of gitweb - please define <b>\\$missmatch_git</b> to a non empty string in your git config file.\\n\";\n\nToo long lines.  Here-doc could be better here.\n\n> +\tprint \"</p>\\n\";\n> +\tgit_footer_html();\n> +\texit;\n> +}\n> +\n>  $projects_list ||= $projectroot;\n>  \n>  # ======================================================================\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129746","messageId":"alpine.DEB.1.00.0912111346070.4985@pacific.mpi-cbg.de","threadId":"21933","inReplyTo":"1260488743-25855-3-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 2/6] GITWEB - Missmatching git w/ gitweb","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-11T12:49:39Z","receivedAt":"2009-12-11T12:49:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 10 Dec 2009, John 'Warthog9' Hawley wrote:\n\n> This adds $missmatch_git so that gitweb can run with a miss-matched\n> git install.\n\nI'm not a native English speaker and all, but I thought it was spelt \n'mismatch', i.e. with only one 's'.  Maybe even name it \n'allow_different_git_version' or 'no_strict_git_version'.\n\nA few comments on the patch: the style of the if() statement disagrees \nwith the other ones; please use the same style.\n\nAlso, as with 1/6, turning off the feature might be better done by setting \nit to undef.\n\nFinally, would it not be nicer if the warning really was only a warning, \ni.e. that the script would try to continue after giving the users a pretty \nwarning header?\n\nCiao,\nDscho\n"},{"id":"129747","messageId":"alpine.DEB.1.00.0912111350340.4985@pacific.mpi-cbg.de","threadId":"21933","inReplyTo":"1260488743-25855-4-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 3/6] GITWEB - Add git:// link to summary pages","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-12-11T12:52:23Z","receivedAt":"2009-12-11T12:52:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 10 Dec 2009, John 'Warthog9' Hawley wrote:\n\n> This adds a git:// link to the summary pages should a common $gitlinkurl \n> be defined (default is nothing defined, thus nothing shown)\n\nNice.\n\nI forgot to mention in my comments to 2/6 that you seem to wrap after more \nthan 80 characters.  However, I have no idea what the suggested line width \nis for gitweb.\n\nAgain, this could be done by having the variable defined as undef.\n\nMaybe it would be even nicer if the administrator could specify the \nprotocol, e.g. when they do not want/cannot allow git:// but only http:// \naccess to the repositories?\n\nCiao,\nDscho\n"},{"id":"129749","messageId":"m3tyvxd3pr.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-4-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 3/6] GITWEB - Add git:// link to summary pages","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T13:44:52Z","receivedAt":"2009-12-11T13:44:52Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n> This adds a git:// link to the summary pages should a common\n> $gitlinkurl be defined (default is nothing defined, thus nothing\n> shown)\n> \n> This does make the assumption that the git trees share a common\n> path, and nothing to date is known to actually make use of the link\n\nThe problem I had and have with this patch is the duplication of data:\n$gitlinkurl contains subset of information in @git_base_url_list,\nwhich in turn is filled from GITWEB_BASE_URL build config variable.\n\nI can understand that for performance reason you don't want to check\n$projectroot/$project/cloneurl nor gitweb.url config variable for\neach and every displayed project; if the link to repository (for git)\ncannot be derived from project path (repository path), then simply\ndo not dosplay it.\n\n> \n> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n> ---\n>  gitweb/gitweb.perl |    8 ++++++++\n>  1 files changed, 8 insertions(+), 0 deletions(-)\n> \n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index d84f4c0..7ad096c 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -224,6 +224,10 @@ our %avatar_size = (\n>  # This is here to allow for missmatch git & gitweb versions\n>  our $missmatch_git = '';\n>  \n> +#This is here to deal with an extra link on the summary pages - if it's left blank\n> +# this link will not be shwon.  If it's set, this will be prepended to the repo and used\n\ns/shwon/shown/\n\nI'd say that 'Full URL is \"$gitlinkurl/$project\"' instead of last\nsentence in above comment.\n\nPlease watch for excessive line lengths.\n\n> +our $gitlinkurl = '';\n\nWhy not\n\nour $gitlinkurl_base = \"++GITWEB_BASE_URL++\";\n\nof course changing the name everywhere.\n\n> +\n>  # Used to set the maximum load that we will still respond to gitweb queries.\n>  # if we exceed this than we do the processing to figure out if there's a mirror\n>  # and redirect to it, or to just return 503 server busy\n> @@ -4454,6 +4458,10 @@ sub git_project_list_body {\n>  \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"log\")}, \"log\") . \" | \" .\n>  \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"tree\")}, \"tree\") .\n>  \t\t      ($pr->{'forks'} ? \" | \" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"forks\")}, \"forks\") : '') .\n> +     \t\tif( $gitlinkurl ne '' ){\n> +\t\t\tprint \" | \". $cgi->a({-href => \"git://$gitlinkurl/\".esc_html($pr->{'path'})}, \"git\");\n> +\t\t}\n> +\t\tprint \"\".\n\nDoes it even pass tests?\n\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"log\")}, \"log\") . \" | \" .\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"tree\")}, \"tree\") .\n \t\t      ($pr->{'forks'} ? \" | \" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"forks\")}, \"forks\") : '') .\n+     \t\t      ($gitlinkurl_base ? \n+\t\t       \" | \" . $cgi->a({-href=>\"$gitlinkurl_base/$pr->{'path'}\", \"git\") : '') .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\\n\";\n \t}\n\nChanges made: \n* Instead of using separate if conditional statement and print\n  statement (note that you forgot to change '.' to ';' to end\n  statement) use ternary conditional operator \"?:\"\n* Make $gitlinkurl_base include \"git://\" protocol specifier\n* Do not create \"git\" link if $gitlinkurl_base is false, which means\n  undef, empty string '' and 0 (but 0 is not very likely to be base\n  for \"git\" link).\n* Do not use esc_html on fragment of URL.  The CGI.pm should escape\n  attributes itself.  If it was HTTP link, one should perhaps esc_url\n  on whole link, but esc_html is for escaping HTML.\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129751","messageId":"20091211165334.453921b5@pbmiha.malagasy.com","threadId":"21933","inReplyTo":"1260488743-25855-2-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 1/6] GITWEB - Load Checking","fromName":"Mihamina Rakotomandimby","fromEmail":"mihamina@gulfsat.mg","sentAt":"2009-12-11T13:53:34Z","receivedAt":"2009-12-11T13:53:34Z","isPatch":true,"sender":{"key":"mihamina@gulfsat.mg","avatar":null},"body":"> \"John 'Warthog9' Hawley\" <warthog9@kernel.org> :\n> +    open($load, '<', '/proc/loadavg') or return 0;\n\nWhat about systems not having /proc/loadavg\n\n-- \n       Architecte Informatique chez Blueline/Gulfsat:\n    Administration Systeme, Recherche & Developpement\n                +261 34 29 155 34 / +261 33 11 207 36\n"},{"id":"129752","messageId":"m3pr6ld1p2.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-5-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 4/6] GITWEB - Makefile changes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T14:28:31Z","receivedAt":"2009-12-11T14:28:31Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\nBelow are _proposed_ changes to make commit message easier to read, in\nmy opinion.  But they are not _necessary_ changes.\n\n> This adjust the makefiles so that you can do such things as\n\nAdd \"gitweb\" target to main Makefile so you would be able to simply\nuse\n\n> \n> \tmake gitweb\n> \n> from the top level make tree,\n\ninstead of requiring to spell it in full\n\n\tmake gitweb/gitweb.cgi\n\n>                               or if your in the gitweb directory\n> itself typing\n\nAdd Makefile in gitweb subdirectory so one can simply run\n> \n> \tmake\n\nwhen in gitweb subdirectory,\n\n> \n> will call back up to the main Makefile and build gitweb\n> \n> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n\nSignoff mismatch.\n\n> ---\n>  Makefile        |    4 +++-\n>  gitweb/Makefile |   14 ++++++++++++++\n>  2 files changed, 17 insertions(+), 1 deletions(-)\n>  create mode 100644 gitweb/Makefile\n\nIMPORTANT!\n\nA note about this change: I think it would be better to move creating\ngitweb.cgi (and optionally gitweb.min.js) to gitweb/Makefile, and make\nmain Makefile call gitweb/Makefile, and not vice versa like in your\nsolution.\n\nIf it is possible.\n \n> diff --git a/Makefile b/Makefile\n> index 4a1e5bc..8db9d01 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1509,6 +1509,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n>  \tchmod +x $@+ && \\\n>  \tmv $@+ $@\n>  \n> +.PHONY: gitweb\n\nWhy it is here, and not with the .PHONY block at line 1924 of\nMakefile?  It would be nice to have comment supporting this choice in\nemail with this patch (or in commit message).\n\n> +gitweb: gitweb/gitweb.cgi\n>  ifdef JSMIN\n>  OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n>  gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n> @@ -1537,7 +1539,7 @@ endif\n>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n> -\t    $< >$@+ && \\\n> +\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n\nWhy this change?\n\n>  \tchmod +x $@+ && \\\n>  \tmv $@+ $@\n>  \n> diff --git a/gitweb/Makefile b/gitweb/Makefile\n> new file mode 100644\n> index 0000000..8d318b3\n> --- /dev/null\n> +++ b/gitweb/Makefile\n> @@ -0,0 +1,14 @@\n> +SHELL = /bin/bash\n\nWhy is this needed?\n\n> +\n> +FILES = gitweb.cgi\n> +\n> +.PHONY: $(FILES)\n\nWhy .PHONY?  $(FILES) are created.\n\n> +\n> +all: $(FILES)\n> +\n> +$(FILES):\n> +\t$(MAKE) $(MFLAGS) -C ../ -f Makefile gitweb/$@\n> +\n> +clean:\n> +\trm -rf $(FILES)\n> +\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129755","messageId":"m3ljh9cy3b.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-7-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T15:46:23Z","receivedAt":"2009-12-11T15:46:23Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n> This is an attempt to break out the default values & associated\n> documentation from the main gitweb file so that it's easier to\n> browse / read and understand without the associated code involved.\n> \n> This helps by making defaults self contained with their documentation\n> making it easier for someone to read through things and find what\n> they want\n> \n> This is also a not-so-subtle start of trying to break up gitweb into\n> separate files for easier maintainability, having everything in a\n> single file is just a mess and makes the whole thing more complicated\n> than it needs to be.  This is a bit of a baby step towards breaking it\n> up for easier maintenance.\n\nThe question is if easier maintenance and development by spliting\ngitweb for developers offsets ease of install for users.\n\n> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n\nSignoff mismatch.\n\n> ---\n>  .gitignore                  |    1 +\n>  Makefile                    |   15 +-\n>  gitweb/Makefile             |    2 +-\n>  gitweb/gitweb.perl          |  515 +++++--------------------------------------\n>  gitweb/gitweb_defaults.perl |  468 +++++++++++++++++++++++++++++++++++++++\n>  5 files changed, 537 insertions(+), 464 deletions(-)\n>  create mode 100644 gitweb/gitweb_defaults.perl\n> \n> \n> diff --git a/.gitignore b/.gitignore\n> index ac02a58..5e48102 100644\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -151,6 +151,7 @@\n>  /git-core-*/?*\n>  /gitk-git/gitk-wish\n>  /gitweb/gitweb.cgi\n> +/gitweb/gitweb_defaults.pl\n\nHmmm... gitweb/gitweb_defaults.perl as source file, and\ngitweb/gitweb_defaults.pl as generated file?  Wouldn't it be better to\ngo with the convention used elsewhere in gitweb and use\ngitweb/gitweb_defaults.perl.in or gitweb/gitweb_defaults.pl.in as\nsource file?\n\n>  /test-chmtime\n>  /test-ctype\n>  /test-date\n> diff --git a/Makefile b/Makefile\n> index 8db9d01..2c5f139 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1510,14 +1510,16 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n>  \tmv $@+ $@\n>  \n>  .PHONY: gitweb\n> -gitweb: gitweb/gitweb.cgi\n> +gitweb: gitweb/gitweb.cgi gitweb/gitweb_defaults.pl\n>  ifdef JSMIN\n> -OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n> -gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n> +OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js gitweb/gitweb_defaults.pl\n> +gitweb/gitweb.cgi gitweb/gitweb_defaults.pl: gitweb/gitweb.perl gitweb/gitweb.min.js gitweb/gitweb_defaults.perl\n>  else\n> -OTHER_PROGRAMS += gitweb/gitweb.cgi\n> -gitweb/gitweb.cgi: gitweb/gitweb.perl\n> +OTHER_PROGRAMS += gitweb/gitweb.cgi gitweb/gitweb_defaults.pl\n> +gitweb/gitweb.cgi: gitweb/gitweb_defaults.pl\n> +gitweb/gitweb.cgi gitweb/gitweb_defaults.pl: gitweb/gitweb.perl gitweb/gitweb_defaults.perl\n>  endif\n\n> +\t#$(QUIET_GEN)$(RM) $@ $@+ &&\n\nWhat this line is about?\n\n>  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n>  \tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>  \t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n> @@ -1539,7 +1541,7 @@ endif\n>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n> -\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n> +\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl, %.perl, $@)) >$@+ && \\\n\nWhy the slightly inconsistent style (\"%.cgi,%perl\" vs \"%.pl, %perl\")?\n\n\nAlso wouldn't all replacements be in the new gitweb_defaults file, so\nthere would be no need then to do replacements for gitweb.cgi?\n\nOh, I see there is at least one that stayed in gitweb.perl: $version\n\n>  \tchmod +x $@+ && \\\n>  \tmv $@+ $@\n>  \n> @@ -1913,6 +1915,7 @@ clean:\n>  \t$(MAKE) -C Documentation/ clean\n>  ifndef NO_PERL\n>  \t$(RM) gitweb/gitweb.cgi\n> +\t$(RM) gitweb/gitweb_defaults.pl\n>  \t$(MAKE) -C perl clean\n>  endif\n>  \t$(MAKE) -C templates/ clean\n> diff --git a/gitweb/Makefile b/gitweb/Makefile\n> index 8d318b3..2bd421a 100644\n> --- a/gitweb/Makefile\n> +++ b/gitweb/Makefile\n> @@ -1,6 +1,6 @@\n>  SHELL = /bin/bash\n>  \n> -FILES = gitweb.cgi\n> +FILES = gitweb.cgi gitweb_defaults.pl\n>  \n>  .PHONY: $(FILES)\n>  \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 3b44371..fd41539 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -36,466 +36,67 @@ our $version = \"++GIT_VERSION++\";\n>  our $my_url = $cgi->url();\n>  our $my_uri = $cgi->url(-absolute => 1);\n>  \n\n[cut deletion]\n\n> +# Define and than setup our configuration \n> +#\n> +our(\n> +\t$VERSION,\n> +\t$path_info,\n> +\t$GIT,\n> +\t$projectroot,\n> +\t$project_maxdepth,\n> +\t$home_link,\n> +\t$home_link_str,\n> +\t$site_name,\n> +\t$site_header,\n> +\t$home_text,\n> +\t$site_footer,\n> +\t@stylesheets,\n> +\t$stylesheet,\n> +\t$logo,\n> +\t$favicon,\n> +\t$javascript,\n> +\t$logo_url,\n> +\t$logo_label,\n> +\t$projects_list,\n> +\t$projects_list_description_width,\n> +\t$default_projects_order,\n> +\t$export_ok,\n> +\t$export_auth_hook,\n> +\t$strict_export,\n> +\t@git_base_url_list,\n> +\t$default_blob_plain_mimetype,\n> +\t$default_text_plain_charset,\n> +\t$mimetypes_file,\n> +\t$missmatch_git,\n> +\t$gitlinkurl,\n> +\t$maxload,\n> +\t$cache_enable,\n> +\t$minCacheTime,\n> +\t$maxCacheTime,\n> +\t$cachedir,\n> +\t$backgroundCache,\n> +\t$nocachedata,\n> +\t$nocachedatabin,\n> +\t$fullhashpath,\n> +\t$fullhashbinpath,\n> +\t$export_auth_hook,\n> +\t%known_snapshot_format_aliases,\n> +\t%known_snapshot_formats,\n> +\t$path_info,\n> +\t$fallback_encoding,\n> +\t%avatar_size,\n> +\t$project_maxdepth,\n> +\t$headerRefresh,\n> +\t$base_url,\n> +\t$projects_list_description_width,\n> +\t$default_projects_order,\n> +\t$prevent_xss,\n> +\t@diff_opts,\n> +\t%feature\n>  );\n\nWhy this block is required?  Why not have variables defined (using\n\"our\") in gitweb_defaults file?\n\n[cut deletion]  \n\n> +do 'gitweb_defaults.pl';\n>  \n>  sub gitweb_get_feature {\n>  \tmy ($name) = @_;\n> diff --git a/gitweb/gitweb_defaults.perl b/gitweb/gitweb_defaults.perl\n> new file mode 100644\n> index 0000000..ede0daf\n> --- /dev/null\n> +++ b/gitweb/gitweb_defaults.perl\n> @@ -0,0 +1,468 @@\n> +# gitweb - simple web interface to track changes in git repositories\n> +#\n> +# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>\n> +# (C) 2005, Christian Gierke\n> +#\n> +# This program is licensed under the GPLv2\n> +\n> +# Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n> +# needed and used only for URLs with nonempty PATH_INFO\n> +$base_url = $my_url;\n\nWhy not \"our $base_url = $my_url;\"?\n\n[cut]\n\n> +1;\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129756","messageId":"m3hbrxcxuu.fsf@localhost.localdomain","threadId":"21933","inReplyTo":"1260488743-25855-1-git-send-email-warthog9@kernel.org","subject":"Re: [PATCH 0/6] Gitweb caching changes v2","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T15:51:20Z","receivedAt":"2009-12-11T15:51:20Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n> Evening everyone,\n> \n> This is the latest incarnation of gitweb w/ caching.  This is\n> finally at the point where it should probably start either being\n> considered for inclusion or mainline, or I need to accept that this\n> will never get in and more perminantely fork (as is the case with\n> Fedora where this is going in as gitweb-caching as a parrallel rpm\n> package).\n> \n> That said this brings the base up to mainline (again), it updates a\n> number of elements in the caching engine, and this is a much cleaner\n> break-out of the tree vs. what I am currently developing against.\n> \n> New things known to work:\n>     - Better breakout\n>     - You can actually disable the cache now\n> \n> - John 'Warthog9' Hawley \n> \n> John 'Warthog9' Hawley (6):\n>   GITWEB - Load Checking\n>   GITWEB - Missmatching git w/ gitweb\n>   GITWEB - Add git:// link to summary pages\n>   GITWEB - Makefile changes\n>   GITWEB - File based caching layer\n\nThis patch didn't made it to git mailing list.  I suspect that you ran\nafoul vger anti-SPAM filter.\n\nDoes this \"File based caching layer\" have anything common with GSoC\n2008 project, available at git://repo.or.cz/git/gitweb-caching.git ?\n\n>   GITWEB - Separate defaults from main file\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"129757","messageId":"4B226C0F.2070407@kernel.org","threadId":"21933","inReplyTo":"m3ljh9cy3b.fsf@localhost.localdomain","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-11T15:58:07Z","receivedAt":"2009-12-11T15:58:07Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":">> This is also a not-so-subtle start of trying to break up gitweb into\n>> separate files for easier maintainability, having everything in a\n>> single file is just a mess and makes the whole thing more complicated\n>> than it needs to be.  This is a bit of a baby step towards breaking it\n>> up for easier maintenance.\n> \n> The question is if easier maintenance and development by spliting\n> gitweb for developers offsets ease of install for users.\n\nThis would just get dropped into the same location that gitweb.cgi \nexists in, there is no real difference in installation, and thus I can't \nsee this as an issue for users.\n\n> \n>> Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>\n> \n> Signoff mismatch.\n> \n>> ---\n>>  .gitignore                  |    1 +\n>>  Makefile                    |   15 +-\n>>  gitweb/Makefile             |    2 +-\n>>  gitweb/gitweb.perl          |  515 +++++--------------------------------------\n>>  gitweb/gitweb_defaults.perl |  468 +++++++++++++++++++++++++++++++++++++++\n>>  5 files changed, 537 insertions(+), 464 deletions(-)\n>>  create mode 100644 gitweb/gitweb_defaults.perl\n>>\n>>\n>> diff --git a/.gitignore b/.gitignore\n>> index ac02a58..5e48102 100644\n>> --- a/.gitignore\n>> +++ b/.gitignore\n>> @@ -151,6 +151,7 @@\n>>  /git-core-*/?*\n>>  /gitk-git/gitk-wish\n>>  /gitweb/gitweb.cgi\n>> +/gitweb/gitweb_defaults.pl\n> \n> Hmmm... gitweb/gitweb_defaults.perl as source file, and\n> gitweb/gitweb_defaults.pl as generated file?  Wouldn't it be better to\n> go with the convention used elsewhere in gitweb and use\n> gitweb/gitweb_defaults.perl.in or gitweb/gitweb_defaults.pl.in as\n> source file?\n\nI think you got confused, the committed file is .perl the generated file \nis .pl.\n\n>> +\t#$(QUIET_GEN)$(RM) $@ $@+ &&\n> \n> What this line is about?\n\nCruft, thought I had deleted and excluded it, won't be there in next \nversion.\n\n> \n>>  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n>>  \tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>>  \t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n>> @@ -1539,7 +1541,7 @@ endif\n>>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n>> -\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n>> +\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl, %.perl, $@)) >$@+ && \\\n> \n> Why the slightly inconsistent style (\"%.cgi,%perl\" vs \"%.pl, %perl\")?\n\nConsidering that the defaults is more of an include vs. a cgi it \nprobably shouldn't share the standard expected executable suffix, thus I \nused .pl.  Could just as easily change it to .pm, or something else but \nI think it would make the most sense to leave things we are expecting \nthe webserver to directly execute as .cgi, and includes as a different \nsuffix.\n\n> Also wouldn't all replacements be in the new gitweb_defaults file, so\n> there would be no need then to do replacements for gitweb.cgi?\n\nNot all replacements are done in one or the other, and since it's \nbasically a NOP to perform the full set of replacements on both files \nthat seemed the easiest way to ensure they were done in both places.\n\n> Oh, I see there is at least one that stayed in gitweb.perl: $version\n> \n\n<snip>\n\n>> +# Define and than setup our configuration \n>> +#\n>> +our(\n>> +\t$VERSION,\n>> +\t$path_info,\n>> +\t$GIT,\n>> +\t$projectroot,\n>> +\t$project_maxdepth,\n>> +\t$home_link,\n>> +\t$home_link_str,\n>> +\t$site_name,\n>> +\t$site_header,\n>> +\t$home_text,\n>> +\t$site_footer,\n>> +\t@stylesheets,\n>> +\t$stylesheet,\n>> +\t$logo,\n>> +\t$favicon,\n>> +\t$javascript,\n>> +\t$logo_url,\n>> +\t$logo_label,\n>> +\t$projects_list,\n>> +\t$projects_list_description_width,\n>> +\t$default_projects_order,\n>> +\t$export_ok,\n>> +\t$export_auth_hook,\n>> +\t$strict_export,\n>> +\t@git_base_url_list,\n>> +\t$default_blob_plain_mimetype,\n>> +\t$default_text_plain_charset,\n>> +\t$mimetypes_file,\n>> +\t$missmatch_git,\n>> +\t$gitlinkurl,\n>> +\t$maxload,\n>> +\t$cache_enable,\n>> +\t$minCacheTime,\n>> +\t$maxCacheTime,\n>> +\t$cachedir,\n>> +\t$backgroundCache,\n>> +\t$nocachedata,\n>> +\t$nocachedatabin,\n>> +\t$fullhashpath,\n>> +\t$fullhashbinpath,\n>> +\t$export_auth_hook,\n>> +\t%known_snapshot_format_aliases,\n>> +\t%known_snapshot_formats,\n>> +\t$path_info,\n>> +\t$fallback_encoding,\n>> +\t%avatar_size,\n>> +\t$project_maxdepth,\n>> +\t$headerRefresh,\n>> +\t$base_url,\n>> +\t$projects_list_description_width,\n>> +\t$default_projects_order,\n>> +\t$prevent_xss,\n>> +\t@diff_opts,\n>> +\t%feature\n>>  );\n> \n> Why this block is required?  Why not have variables defined (using\n> \"our\") in gitweb_defaults file?\n\nWanted to make sure things were properly defined, if in an unexpected \nstate, should a user have gitweb.cgi in place but not the defaults.\n\n> \n> [cut deletion]  \n> \n>> +do 'gitweb_defaults.pl';\n>>  \n>>  sub gitweb_get_feature {\n>>  \tmy ($name) = @_;\n>> diff --git a/gitweb/gitweb_defaults.perl b/gitweb/gitweb_defaults.perl\n>> new file mode 100644\n>> index 0000000..ede0daf\n>> --- /dev/null\n>> +++ b/gitweb/gitweb_defaults.perl\n>> @@ -0,0 +1,468 @@\n>> +# gitweb - simple web interface to track changes in git repositories\n>> +#\n>> +# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>\n>> +# (C) 2005, Christian Gierke\n>> +#\n>> +# This program is licensed under the GPLv2\n>> +\n>> +# Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n>> +# needed and used only for URLs with nonempty PATH_INFO\n>> +$base_url = $my_url;\n> \n> Why not \"our $base_url = $my_url;\"?\n\nsame reason as the other 'our' includes above, though why this ended up \nas a separate patch vs. the rest of the file I don't know.\n\n- John 'Warthog9' Hawley\n"},{"id":"129758","messageId":"4B2271B4.2010301@kernel.org","threadId":"21933","inReplyTo":"m3pr6ld1p2.fsf@localhost.localdomain","subject":"Re: [PATCH 4/6] GITWEB - Makefile changes","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-11T16:22:12Z","receivedAt":"2009-12-11T16:22:12Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"<snip>\n\n> IMPORTANT!\n> \n> A note about this change: I think it would be better to move creating\n> gitweb.cgi (and optionally gitweb.min.js) to gitweb/Makefile, and make\n> main Makefile call gitweb/Makefile, and not vice versa like in your\n> solution.\n> \n> If it is possible.\n\nIt's quite possible, and I'm fine with doing that.  If no one has any \nobjections I can re-work those with the understanding that the build \nprocess for gitweb shift to the gitweb/ directory instead of the main \nMakefile.\n\n>  \n>> diff --git a/Makefile b/Makefile\n>> index 4a1e5bc..8db9d01 100644\n>> --- a/Makefile\n>> +++ b/Makefile\n>> @@ -1509,6 +1509,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n>>  \tchmod +x $@+ && \\\n>>  \tmv $@+ $@\n>>  \n>> +.PHONY: gitweb\n> \n> Why it is here, and not with the .PHONY block at line 1924 of\n> Makefile?  It would be nice to have comment supporting this choice in\n> email with this patch (or in commit message).\n\nThere are 6 other instances of .PHONY in the makefile, having the .PHONY \nlocalized seemed to make it the most obvious since it was right next to \nthe actual target.\n\n> \n>> +gitweb: gitweb/gitweb.cgi\n>>  ifdef JSMIN\n>>  OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n>>  gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n>> @@ -1537,7 +1539,7 @@ endif\n>>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n>> -\t    $< >$@+ && \\\n>> +\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n> \n> Why this change?\n\nPreparation for a later change.  The change could happen all at the same \ntime if it makes more logical sense.\n\n> \n>>  \tchmod +x $@+ && \\\n>>  \tmv $@+ $@\n>>  \n>> diff --git a/gitweb/Makefile b/gitweb/Makefile\n>> new file mode 100644\n>> index 0000000..8d318b3\n>> --- /dev/null\n>> +++ b/gitweb/Makefile\n>> @@ -0,0 +1,14 @@\n>> +SHELL = /bin/bash\n> \n> Why is this needed?\n> \n>> +\n>> +FILES = gitweb.cgi\n>> +\n>> +.PHONY: $(FILES)\n> \n> Why .PHONY?  $(FILES) are created.\n\n From this makefile I wanted to explicitly call up to the main makefile \nno matter what, the main makefile doesn't consider the targets .PHONY \nand it has all the dependencies that it would expect.\n\n>> +\n>> +all: $(FILES)\n>> +\n>> +$(FILES):\n>> +\t$(MAKE) $(MFLAGS) -C ../ -f Makefile gitweb/$@\n>> +\n>> +clean:\n>> +\trm -rf $(FILES)\n>> +\n"},{"id":"129759","messageId":"200912111741.51760.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B2271B4.2010301@kernel.org","subject":"Re: [PATCH 4/6] GITWEB - Makefile changes","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T16:41:51Z","receivedAt":"2009-12-11T16:41:51Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 11 Dec 2009, J.H. wrote:\n\n>> IMPORTANT!\n>> \n>> A note about this change: I think it would be better to move creating\n>> gitweb.cgi (and optionally gitweb.min.js) to gitweb/Makefile, and make\n>> main Makefile call gitweb/Makefile, and not vice versa like in your\n>> solution.\n>> \n>> If it is possible.\n> \n> It's quite possible, and I'm fine with doing that.  If no one has any \n> objections I can re-work those with the understanding that the build \n> process for gitweb shift to the gitweb/ directory instead of the main \n> Makefile.\n\nIn my opinion it would be better solution because it would reduce size\nof main (master) Makefile, and not be much larger than this solution.\n \ngit-gui/, Documentation/, perl/ all have their own makefiles, which do\nthe work, and are called from main (master) Makefile.\n\n>>> diff --git a/Makefile b/Makefile\n>>> index 4a1e5bc..8db9d01 100644\n>>> --- a/Makefile\n>>> +++ b/Makefile\n>>> @@ -1509,6 +1509,8 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n>>>  \tchmod +x $@+ && \\\n>>>  \tmv $@+ $@\n>>>  \n>>> +.PHONY: gitweb\n>> \n>> Why it is here, and not with the .PHONY block at line 1924 of\n>> Makefile?  It would be nice to have comment supporting this choice in\n>> email with this patch (or in commit message).\n> \n> There are 6 other instances of .PHONY in the makefile, having the .PHONY \n> localized seemed to make it the most obvious since it was right next to \n> the actual target.\n\nI was thinking here about this large block of .PHONY declarations,\nthe one which is not inside conditional.\n \n>>> +gitweb: gitweb/gitweb.cgi\n>>>  ifdef JSMIN\n>>>  OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n>>>  gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n>>> @@ -1537,7 +1539,7 @@ endif\n>>>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>>>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>>>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n>>> -\t    $< >$@+ && \\\n>>> +\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n>> \n>> Why this change?\n> \n> Preparation for a later change.  The change could happen all at the same \n> time if it makes more logical sense.\n\nPlease at least describe this change in commit message.\n\nBut I think it could be moved to other patch, or put in separate patch.\nThis change has nothing to do with easier gitweb generation.\n \n>>>  \tchmod +x $@+ && \\\n>>>  \tmv $@+ $@\n>>>  \n>>> diff --git a/gitweb/Makefile b/gitweb/Makefile\n>>> new file mode 100644\n>>> index 0000000..8d318b3\n>>> --- /dev/null\n>>> +++ b/gitweb/Makefile\n>>> @@ -0,0 +1,14 @@\n>>> +SHELL = /bin/bash\n>> \n>> Why is this needed?\n\nWhy do you need to define SHELL?\n \n>>> +\n>>> +FILES = gitweb.cgi\n>>> +\n>>> +.PHONY: $(FILES)\n>> \n>> Why .PHONY?  $(FILES) are created.\n> \n>  From this makefile I wanted to explicitly call up to the main makefile \n> no matter what, the main makefile doesn't consider the targets .PHONY \n> and it has all the dependencies that it would expect.\n\nWhat is the reason of this phony .PHONY?  If gitweb.cgi is newer than\ngitweb.perl (and other sources), then without .PHONY it wouldn't be \nregenerated.  With .PHONY it would call master Makefile... which would\nnotice that gitweb.cgi is newer than gitweb.perl and do not regenerate.\n \nSo what this .PHONY does is unnecessary call make on master Makefile...\n\n\n\nBut I guess this issue would be moot if it was the other way around,\ni.e. master Makefile calling gitweb/Makefile.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"129760","messageId":"200912111901.35781.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B226D56.7000004@kernel.org","subject":"Re: [PATCH 0/6] Gitweb caching changes v2","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T18:01:34Z","receivedAt":"2009-12-11T18:01:34Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 11 Dec 2009, J.H. (John 'Warthog9' Hawley) wrote:\n> Jakub Narebski wrote:\n>> \"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n\n>>> John 'Warthog9' Hawley (6):\n>>>   GITWEB - Load Checking\n>>>   GITWEB - Missmatching git w/ gitweb\n>>>   GITWEB - Add git:// link to summary pages\n>>>   GITWEB - Makefile changes\n>>>   GITWEB - File based caching layer\n>> \n>> This patch didn't made it to git mailing list.  I suspect that you ran\n>> afoul vger anti-SPAM filter.\n>> \n>> Does this \"File based caching layer\" have anything common with GSoC\n>> 2008 project, available at git://repo.or.cz/git/gitweb-caching.git ?\n> \n> Yeah, it does seem that way (like I said eaten by a grue), it \n> *currently* has nothing to do with Lea's GSoC code but it is still my \n> intention, long term, to integrate the two.\n> \n> The patch, in all it's glory can be viewed at: \n> http://git.kernel.org/?p=git/warthog9/gitweb.git;a=commitdiff;h=42641b1e3bfae14d5cc2e0150355e89cb87951db\n> \n> It is anything but a small patch to gitweb, the patch is 117K and \n> comprises 3539 lines (including git header commit information).  There's \n> not any real good way to break it up as it's a bit of an all or nothing \n> patch.\n\nFirst, why do you reinvent the wheel instead of using one of existing\ncaching interfaces like CHI or Cache::Cache (perhaps creating a custom\nbackend or middle layer which incorporates required features, like being\nload-aware)?  This way changing from file-based cache to e.g. mmap based\none or to memcached would be very simple.  And you would avoid pitfals\nin doing your own cache management.  perl-Cache-Cache should be available\npackage in extras repositories.\n\nIf module is no available this would simply mean no caching, like in many\n(or not so many) other cases with optional features in gitweb.\n\n\nSecond, if you can't use CGI::Cache directly, you can always steal the\nidea from it, then the change to gitweb itself would be minimal:\n\n  \"Internally, the CGI::Cache module ties the output file descriptor\n  (usually STDOUT) to an internal variable to which all output is saved.\"\n\n\nP.S. I'll postpone critique of the patch itself for now.  The above issues\nare much more important.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"129761","messageId":"4B228ED3.3030901@kernel.org","threadId":"21933","inReplyTo":"200912111901.35781.jnareb@gmail.com","subject":"Re: [PATCH 0/6] Gitweb caching changes v2","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-11T18:26:27Z","receivedAt":"2009-12-11T18:26:27Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"Jakub Narebski wrote:\n> On Fri, 11 Dec 2009, J.H. (John 'Warthog9' Hawley) wrote:\n>> Jakub Narebski wrote:\n>>> \"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n> \n>>>> John 'Warthog9' Hawley (6):\n>>>>   GITWEB - Load Checking\n>>>>   GITWEB - Missmatching git w/ gitweb\n>>>>   GITWEB - Add git:// link to summary pages\n>>>>   GITWEB - Makefile changes\n>>>>   GITWEB - File based caching layer\n>>> This patch didn't made it to git mailing list.  I suspect that you ran\n>>> afoul vger anti-SPAM filter.\n>>>\n>>> Does this \"File based caching layer\" have anything common with GSoC\n>>> 2008 project, available at git://repo.or.cz/git/gitweb-caching.git ?\n>> Yeah, it does seem that way (like I said eaten by a grue), it \n>> *currently* has nothing to do with Lea's GSoC code but it is still my \n>> intention, long term, to integrate the two.\n>>\n>> The patch, in all it's glory can be viewed at: \n>> http://git.kernel.org/?p=git/warthog9/gitweb.git;a=commitdiff;h=42641b1e3bfae14d5cc2e0150355e89cb87951db\n>>\n>> It is anything but a small patch to gitweb, the patch is 117K and \n>> comprises 3539 lines (including git header commit information).  There's \n>> not any real good way to break it up as it's a bit of an all or nothing \n>> patch.\n> \n> First, why do you reinvent the wheel instead of using one of existing\n> caching interfaces like CHI or Cache::Cache (perhaps creating a custom\n> backend or middle layer which incorporates required features, like being\n> load-aware)?\n\nWell for starters this isn't exactly a reinvention of the wheel, and \nthis isn't something \"new\" per-se.  This code has been actively running \non git.kernel.org for something like 3 - 4 years so there's something to \nbe said for the devil we know and understand.  As well using the other \ncaching strategies involves adding dramatically more complex \ninteractions with caching layer.  The caching layer is actually quite \nspecific to how git + gitweb works and solves more than just \"caching\" \non the surface.  Specifically it solves the stampeding herd problem \nwhich would have to be solved either way even if I didn't implement my \nown caching, and since I had to do that caching was barely a step beyond \nthat to implement.\n\n>  This way changing from file-based cache to e.g. mmap based\n> one or to memcached would be very simple.\n\nTrue but these are *VERY* different caching strategies than the one I've \ngot here, yes it's using files as a backend but it's doing so with \nspecific goals in mind.  As I've said I plan to integrate Lea's \nmemcached based caching into this in the future and that has different \nadvantages and disadvantages.\n\nAt the end of the day the \"normal\" caching engines aren't as efficient \nas mine and there is the case the very high performance sites are going \nto have to investigate a number of different solutions to see what works \nbest for them.  Mine is also *dramatically* simpler to setup as well, \nturn it on, point it at a directory and your done.\n\n>  And you would avoid pitfals\n> in doing your own cache management.  perl-Cache-Cache should be available\n> package in extras repositories.\n\nThere's pitfalls if I do it myself, or I use one of the other \"common\" \nperl modules.  I did it this way years ago, I've maintained it and it \nworks pretty well.  I won't admit that it's the smartest caching engine \non the planet, far from it, but it has evolved specifically for gitweb \nand that itself saves me a lot of pitfalls from cache engine + gitweb \nintegration.\n\n> If module is no available this would simply mean no caching, like in many\n> (or not so many) other cases with optional features in gitweb.\n\nYes, but as can be seen from how you enable various other caching \nengines the setup of those is non-trivial, this is and either way \ncaching *HAS* to be explicitly turned on by the admin/user since they \nare going to have to do *some* configuration, or at least be aware that \ntheir webapp is going to chew up some sort of resource.\n\n> Second, if you can't use CGI::Cache directly, you can always steal the\n> idea from it, then the change to gitweb itself would be minimal:\n> \n>   \"Internally, the CGI::Cache module ties the output file descriptor\n>   (usually STDOUT) to an internal variable to which all output is saved.\"\n\nI thought about that 3 years ago, and decided it wasn't a good option \nfor gitweb.  Why?  There's too many assumptions throughout the code that \nwhen you do a print it will go immediately out.  Things like error \nmessages and such.  Breaking out the prints into prints (which will do \nwhat is expected) and passing around the output in the $output variables \nmakes it a lot simpler easier to differentiate about how / what your \nlooking at and a *LOT* easier to debug.\n\n> P.S. I'll postpone critique of the patch itself for now.  The above issues\n> are much more important.\n\nThat's fine.  The issues your raising aren't new though, and stem back \nto before I created gitweb-caching, got rehashed with Lea's patches and \nnot surprisingly are back on the table now.  Like I said above, there is \nno one caching strategy that's perfect in all cases here and that's \nagain why I eventually plan to merge Lea's changes (which uses \nmemcached) in as well, I'm just trying to get code that I'm getting \nconsiderable demand for, that's proven, upstream.\n\n- John 'Warthog9' Hawley\n"},{"id":"129769","messageId":"200912112353.11034.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B226C0F.2070407@kernel.org","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-11T22:53:09Z","receivedAt":"2009-12-11T22:53:09Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 11 Dec 2009, J.H. wrote:\n\n>>> This is also a not-so-subtle start of trying to break up gitweb into\n>>> separate files for easier maintainability, having everything in a\n>>> single file is just a mess and makes the whole thing more complicated\n>>> than it needs to be.  This is a bit of a baby step towards breaking it\n>>> up for easier maintenance.\n>> \n>> The question is if easier maintenance and development by spliting\n>> gitweb for developers offsets ease of install for users.\n> \n> This would just get dropped into the same location that gitweb.cgi \n> exists in, there is no real difference in installation, and thus I can't \n> see this as an issue for users.\n\nTo be more exact you have to know that you have to drop _generated files_,\nwhich means (for this version of patch) gitweb.cgi and gitweb_defaults.pl\n(or whatever the generated file with config variables would be named).\n\n\nATTENTION!\n\nYour changes would make stop working all gitweb tests.  Currently they\ndo some magic with generated gitweb config file \"$(pwd)/gitweb_config.perl\"\nset via GITWEB_CONFIG configuration variable to be able to run\n_unprocessed_ gitweb/gitweb.perl (without any substitutions).  This\nallow to run tests on \"live\" version of gitweb.\n\nAfter your changes it would be no longer possible, at least not if we\nwant to be sure that we test the same version of gitweb as gitweb_defaults.\n\nIt would probably mean that we need to move to testing built version,\ni.e. gitweb.cgi, not gitweb.perl\n\n>>> ---\n>>>  .gitignore                  |    1 +\n>>>  Makefile                    |   15 +-\n>>>  gitweb/Makefile             |    2 +-\n>>>  gitweb/gitweb.perl          |  515 +++++--------------------------------------\n>>>  gitweb/gitweb_defaults.perl |  468 +++++++++++++++++++++++++++++++++++++++\n>>>  5 files changed, 537 insertions(+), 464 deletions(-)\n>>>  create mode 100644 gitweb/gitweb_defaults.perl\n>>>\n>>>\n>>> diff --git a/.gitignore b/.gitignore\n>>> index ac02a58..5e48102 100644\n>>> --- a/.gitignore\n>>> +++ b/.gitignore\n>>> @@ -151,6 +151,7 @@\n>>>  /git-core-*/?*\n>>>  /gitk-git/gitk-wish\n>>>  /gitweb/gitweb.cgi\n>>> +/gitweb/gitweb_defaults.pl\n>> \n>> Hmmm... gitweb/gitweb_defaults.perl as source file, and\n>> gitweb/gitweb_defaults.pl as generated file?  Wouldn't it be better to\n>> go with the convention used elsewhere in gitweb and use\n>> gitweb/gitweb_defaults.perl.in or gitweb/gitweb_defaults.pl.in as\n>> source file?\n> \n> I think you got confused, the committed file is .perl the generated file \n> is .pl.\n\nMaybe I wasn't entirely clean.  I meant that the committed source file\nshould perhaps have *.in extension to denote that it is to be processed\nvia variable substitution, so it would be\n\n  committed file: gitweb/gitweb_defaults.pl.in\n  generated file: gitweb/gitweb_defaults.pl\n \nor whatever name (*.pm?) we agree on.\n\n>>>  \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n>>>  \tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n>>>  \t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n>>> @@ -1539,7 +1541,7 @@ endif\n>>>  \t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n>>>  \t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n>>>  \t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n>>> -\t    $(patsubst %.cgi,%.perl,$@) >$@+ && \\\n>>> +\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl, %.perl, $@)) >$@+ && \\\n>> \n>> Why the slightly inconsistent style (\"%.cgi,%perl\" vs \"%.pl, %perl\")?\n> \n> Considering that the defaults is more of an include vs. a cgi it \n> probably shouldn't share the standard expected executable suffix, thus I \n> used .pl.  Could just as easily change it to .pm, or something else but \n> I think it would make the most sense to leave things we are expecting \n> the webserver to directly execute as .cgi, and includes as a different \n> suffix.\n\nI was not asking about that, but about\n\n+\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl, %.perl, $@)) >$@+ && \\\n\nvs\n\n+\t    $(patsubst %.cgi,%.perl,$(patsubst %.pl,%.perl,$@)) >$@+ && \\\n\nBut after thinking about it a bit, and consulting make documentation\n(in particular definition of $@ variable) this rule shouldn't work at all.\n\n`$@'\n     The file name of the target of the rule.  If the target is an\n     archive member, then `$@' is the name of the archive file.  In a\n     pattern rule that has multiple targets (*note Introduction to\n     Pattern Rules: Pattern Intro.), `$@' is the name of whichever\n     target caused the rule's commands to be run.\n \nWhat we need is to run pattern substitution for _two_ files, perhaps\nusing the for loop.\n\nAlso I think the order of substitutions would be better to be reversed:\n\n    $(patsubst %.pl,%.perl,$(patsubst %.cgi,%.perl,$FILE)) >$FILE+\n\nThis way the gitweb_defaults file can even have *.perl extension\n\n>> Also wouldn't all replacements be in the new gitweb_defaults file, so\n>> there would be no need then to do replacements for gitweb.cgi?\n> \n> Not all replacements are done in one or the other, and since it's \n> basically a NOP to perform the full set of replacements on both files \n> that seemed the easiest way to ensure they were done in both places.\n> \n>> Oh, I see there is at least one that stayed in gitweb.perl: $version\n>> \n> \n> <snip>\n\nO.K.\n\nBut Makefile would be (slightly) simpler if replacements were needed only\nfor single file of two.\n \n>>> +# Define and than setup our configuration \n>>> +#\n>>> +our(\n>>> +\t$VERSION,\n>>> +\t$path_info,\n>>> +\t$GIT,\n[...]\n>>> +\t$prevent_xss,\n>>> +\t@diff_opts,\n>>> +\t%feature\n>>>  );\n>> \n>> Why this block is required?  Why not have variables defined (using\n>> \"our\") in gitweb_defaults file?\n> \n> Wanted to make sure things were properly defined, if in an unexpected \n> state, should a user have gitweb.cgi in place but not the defaults.\n\nIn my opinion it actually *makes worse*.  I am not sure if gitweb would\nwork if the variables are undefined, and you would lose 'undeclared \nvariable' warning.\n \n>>> diff --git a/gitweb/gitweb_defaults.perl b/gitweb/gitweb_defaults.perl\n>>> new file mode 100644\n>>> index 0000000..ede0daf\n>>> --- /dev/null\n>>> +++ b/gitweb/gitweb_defaults.perl\n>>> @@ -0,0 +1,468 @@\n>>> +# gitweb - simple web interface to track changes in git repositories\n>>> +#\n>>> +# (C) 2005-2006, Kay Sievers <kay.sievers@vrfy.org>\n>>> +# (C) 2005, Christian Gierke\n>>> +#\n>>> +# This program is licensed under the GPLv2\n\nThis header should probably be modified, at least stating what the file\nis for.\n\n>>> +\n>>> +# Base URL for relative URLs in gitweb ($logo, $favicon, ...),\n>>> +# needed and used only for URLs with nonempty PATH_INFO\n>>> +$base_url = $my_url;\n>> \n>> Why not \"our $base_url = $my_url;\"?\n> \n> same reason as the other 'our' includes above,\n\nSee comment above about pre-declaring variables actually making it\nworse wrt checking.\n\n> though why this ended up  \n> as a separate patch vs. the rest of the file I don't know.\n\nErrr... what you are talking about here?\n\n-- \nJakub Narebski\nPoland\n"},{"id":"129776","messageId":"200912120237.31254.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B228ED3.3030901@kernel.org","subject":"Re: [PATCH 0/6] Gitweb caching changes v2","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-12T01:37:29Z","receivedAt":"2009-12-12T01:37:29Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 11 Dec 2009, J.H. wrote:\n> Jakub Narebski wrote:\n>> On Fri, 11 Dec 2009, J.H. (John 'Warthog9' Hawley) wrote:\n>>> Jakub Narebski wrote:\n>>>> \"John 'Warthog9' Hawley\" <warthog9@kernel.org> writes:\n>>>>>\n>>>>>   GITWEB - File based caching layer\n>>>>>\n>>>> This patch didn't made it to git mailing list.  I suspect that you ran\n>>>> afoul vger anti-SPAM filter.\n>>>\n>>> Yeah, it does seem that way (like I said eaten by a grue),\n\nIt _might_ be caused by the fact that you used attachement.  But it might\nnot; you can always use vger-taboo.perl script to check.\n\n>>>> Does this \"File based caching layer\" have anything common with GSoC\n>>>> 2008 project, available at git://repo.or.cz/git/gitweb-caching.git ?\n>>>\n>>> It *currently* has nothing to do with Lea's GSoC code but it is still my \n>>> intention, in long term, to integrate the two.\n\nThe question would be then whether it makes sense to have two caches at\ndifferent levels in the stack (see also discussion below about Lea \napproach).\n\n>>> The patch, in all it's glory can be viewed at: \n>>> http://git.kernel.org/?p=git/warthog9/gitweb.git;a=commitdiff;h=42641b1e3bfae14d5cc2e0150355e89cb87951db\n>>>\n>>> It is anything but a small patch to gitweb, the patch is 117K and \n>>> comprises 3539 lines (including git header commit information).  There's \n>>> not any real good way to break it up as it's a bit of an all or nothing \n>>> patch.\n>> \n>> First, why do you reinvent the wheel instead of using one of existing\n>> caching interfaces like CHI or Cache::Cache (perhaps creating a custom\n>> backend or middle layer which incorporates required features, like being\n>> load-aware)?\n> \n> Well for starters this isn't exactly a reinvention of the wheel, and \n> this isn't something \"new\" per-se.  This code has been actively running \n> on git.kernel.org for something like 3 - 4 years so there's something to \n> be said for the devil we know and understand.\n\nWell, if it is not reinventing the wheel, then it is yak shaving (yet\nanother ...) ;-)\n\nThe fact that the code was used and tested at one single installation\ndoesn't mean that it doesn't have warts that could be avoided by using\nready solution (at least for parts of it).\n\n> As well using the other  \n> caching strategies involves adding dramatically more complex \n> interactions with caching layer.\n\nI am hoping that if it was done right, by using CHI or Cache::Cache\ncaching interface, then choosing alternate caching engine, or adding\nextra level of cache would be simple and decoupled from issues specific\nto web app or gitweb in particular.\n\n> The caching layer is actually quite  \n> specific to how git + gitweb works and solves more than just \"caching\" \n> on the surface.  \n\nThe idea is for gitweb/cache.pm (or gitweb/Gitweb-Cache.pm, or \ngitweb/Gitweb/Cache.pm) is to encapsulate issues specific to gitweb,\nlike generating cache key, or printing \"Generating...\", etc.\n\nPerhaps also the idea of filling cache in background (but see discussion\nbelow about capturing STDOUT) could be put there.\n\n> Specifically it solves the stampeding herd problem  \n> which would have to be solved either way even if I didn't implement my \n> own caching, and since I had to do that caching was barely a step beyond \n> that to implement.\n\nCHI tries to solve cache miss stampedes via expires_variance mechanism.\nThere is Cache::Adaptive (and its subclass Cache::Adaptive::ByLoad)\nwhich does adaptive lifetime control (it accepts any Cache::Cache \ncompatible cache, so I think it also accepts CHI compatible cache).\nThose problems _were_ solved.\n\n>>  This way changing from file-based cache to e.g. mmap based\n>> one or to memcached would be very simple.\n> \n> True but these are *VERY* different caching strategies than the one I've \n> got here, yes it's using files as a backend but it's doing so with \n> specific goals in mind.  As I've said I plan to integrate Lea's \n> memcached based caching into this in the future and that has different \n> advantages and disadvantages.\n\nErrr... besides using Cache::Cache compatible cache (see!!!), for example\nCache::Memcached, Lea Wiemann's gitweb caching did caching at entirely\ndifferent level than original kernel.org's gitweb.\n\nThe stack for gitweb looks somewhat like this:\n\n  git commands output       open my $fd, '-|, git_cmd(), ...\n          |\n          v\n  parsed output data        parse_ls_tree_line, parse_commit, ...\n          |\n          v\n  generated HTML etc.       print ...\n          :\n          V\n       caching              optional\n    reverse proxy           Varnish, Squid\n\nIf I understand correctly Lea Wiemann code cache git command output.\nThe fork of gitweb used at repo.or.cz does caching of parsed data at\nleast for most intensive projects list page.  This patch was about caching\ngenerated output.  HTTP caching requires that gitweb can respond to\nIf-Modified-Since (and generate Last-Modified) and If-None-Match (and\ngenerate ETag) in a time that is much faster than generating full response.\n\nThere are advantages and disadvantages for each method of caching; also\nthe balance might depend on the view used.  For example 'snapshot' view\nis best cached via output caching with file-based cache, while for \n'blame_incremental' view straight caching of output doesn't make much\nsense while caching command output should give good behaviour.\n\n> At the end of the day the \"normal\" caching engines aren't as efficient \n> as mine and there is the case the very high performance sites are going \n> to have to investigate a number of different solutions to see what works \n> best for them.  Mine is also *dramatically* simpler to setup as well, \n> turn it on, point it at a directory and you're done.\n\nDo you have any benchmarks?\n\n>>  And you would avoid pitfals\n>> in doing your own cache management.  perl-Cache-Cache should be available\n>> package in extras repositories.\n> \n> There's pitfalls if I do it myself, or I use one of the other \"common\" \n> perl modules.  I did it this way years ago, I've maintained it and it \n> works pretty well.  I won't admit that it's the smartest caching engine \n> on the planet, far from it, but it has evolved specifically for gitweb \n> and that itself saves me a lot of pitfalls from cache engine + gitweb \n> integration.\n\nIf I remember correctly the solution presented here has serious \ndisadvantage of not having any cache expire policy, and not being \nsize-aware.\n\n>> If module is no available this would simply mean no caching, like in many\n>> (or not so many) other cases with optional features in gitweb.\n> \n> Yes, but as can be seen from how you enable various other caching \n> engines the setup of those is non-trivial, this is and either way \n> caching *HAS* to be explicitly turned on by the admin/user since they \n> are going to have to do *some* configuration, or at least be aware that \n> their webapp is going to chew up some sort of resource.\n\nI wonder if there is any data that describes when one should enable \ncaching, and when one can do without it, e.g. depending on the number\nand total size of repositories presented via gitweb.\n\nIMHO cache storage is orthogonal to expire policy, which in turn is\northogonal on cache use in gitweb.  And those parts should be kept separate\n(and tested independently), even if we decide on homegrown caching\nsolution.\n\n>> Second, if you can't use CGI::Cache directly, you can always steal the\n>> idea from it, then the change to gitweb itself would be minimal:\n>> \n>>   \"Internally, the CGI::Cache module ties the output file descriptor\n>>   (usually STDOUT) to an internal variable to which all output is saved.\"\n> \n> I thought about that 3 years ago, and decided it wasn't a good option \n> for gitweb.  Why?  There's too many assumptions throughout the code that \n> when you do a print it will go immediately out.  Things like error \n> messages and such.  Breaking out the prints into prints (which will do \n> what is expected) and passing around the output in the $output variables \n> makes it a lot simpler easier to differentiate about how / what your \n> looking at and a *LOT* easier to debug.\n\nNote that in quite a few places we print directly to output, streaming\nthe response, for performance (to reduce latency).  If all data must be\nfirst gathered in $output variable (increasing memory pressure in the\ncase of large files for 'blob_plain', large snapshots, large patches in\n'patch' and 'patches' views) then we must wait for it to finish, and not\nget data as soon as it is available.\n\nBesides instead of just capturing STDOUT in tied variable (STDERR goes\nto web server log courtesy of CGI.pm) we can tee it, i.e. capture it\nto $output variable as it is streamed to web browser.  See Capture::Tiny\n(although I am not sure how it would interact with CGI.pm logging) and\ne.g. PerlIO::tee mechanism from PerlIO::Util.\n\nGoing the route of CGI::Cache would mean minimal changes to gitweb...\nand no diference in performance if caching is turned off (see streaming).\n \n>> P.S. I'll postpone critique of the patch itself for now.  The above issues\n>> are much more important.\n> \n> That's fine.  The issues your raising aren't new though, and stem back \n> to before I created gitweb-caching, got rehashed with Lea's patches and \n> not surprisingly are back on the table now.  Like I said above, there is \n> no one caching strategy that's perfect in all cases here and that's \n> again why I eventually plan to merge Lea's changes (which uses \n> memcached) in as well, I'm just trying to get code that I'm getting \n> considerable demand for, that's proven, upstream.\n\nWell, there are two solutions.  One is first to decide on proper solution\nfor gitweb caching.  Another is to have _some_ caching and then improve it.\n\n\nSo below there are a few initial comments about gitweb/cache.pm code:\n\n* gitweb/cache.pm should be, I think, a proper module (require'd or use'd)\n\n* you do not follow coding style used elsewhere in gitweb, e.g. spaces\n  around {} and (), for example it is\n\n    }elsif( $cache_enable == 1 ){\n\n  and should be\n\n    } elsif ($cache_enable == 1) {\n\n* flags that are boolean are compared to 0 and 1\n\n* cache key should be generated from both PATH_INFO and QUERY_STRING\n  in generic case (unless you turn off $path_info as default, and turn off\n  support for path_info URLs); see %input_params hash or href(-replay=>1)\n\n* gitweb till now does not include any variable data in error info\n\n* duplicated code (e.g. fork / cacheUpdate + cacheDisplay / cacheUpdate...)\n\n* inconsistent naming style: cache_fetch but cacheDisplay.\n\n* old style open using globs instead of local filehandles:\n\n    open(cacheFile, '<', \"$fullhashpath\");\n\n  and should be\n\n    open(my $cache_fh, '<', $fullhashpath);\n\n* busy wait 'do { sleep 2; open ... } while (...)' instead of non-blocking\n  wait like select / IO::Select.\n\nThat's all from skimming gitweb-ml-v2:gitweb/cache.pm\n-- \nJakub Narebski\nPoland\n"},{"id":"129974","messageId":"7v8wd3ww4d.fsf@alter.siamese.dyndns.org","threadId":"21933","inReplyTo":"200912112353.11034.jnareb@gmail.com","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-12-16T01:22:42Z","receivedAt":"2009-12-16T01:22:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> On Fri, 11 Dec 2009, J.H. wrote:\n>\n>>>> This is also a not-so-subtle start of trying to break up gitweb into\n>>>> separate files for easier maintainability, having everything in a\n>>>> single file is just a mess and makes the whole thing more complicated\n>>>> than it needs to be.  This is a bit of a baby step towards breaking it\n>>>> up for easier maintenance.\n>>> \n>>> The question is if easier maintenance and development by spliting\n>>> gitweb for developers offsets ease of install for users.\n>> \n>> This would just get dropped into the same location that gitweb.cgi \n>> exists in, there is no real difference in installation, and thus I can't \n>> see this as an issue for users.\n>\n> To be more exact you have to know that you have to drop _generated files_,\n> which means (for this version of patch) gitweb.cgi and gitweb_defaults.pl\n> (or whatever the generated file with config variables would be named).\n>\n>\n> ATTENTION!\n\nYou didn't have to shout.\n\nAny progress on this front?\n\nNot that I am anxious to queue new topics to 'next' right now (we are\nfrozen for 1.6.6), but I think having what is proven to work well at a\nreal site like k.org is much better than waiting for an unproven\nreimplementation using somebody else's framework only for your theoretical\ncleanliness.  John has better things to do than doing such a rewrite\nhimself, and even if you helped the process by producing a competing\ncaching scheme based on existing web caching engines, the aggregated\nresult (not just the web caching engine you base your work on) needs to\nget a similar field exposure to prove itself that it can scale to the load\nk.org sees, which would be quite a lot of work, no?\n"},{"id":"129977","messageId":"4B283F3D.3020209@kernel.org","threadId":"21933","inReplyTo":"7v8wd3ww4d.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-16T02:00:29Z","receivedAt":"2009-12-16T02:00:29Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n>> On Fri, 11 Dec 2009, J.H. wrote:\n>>\n>>>>> This is also a not-so-subtle start of trying to break up gitweb into\n>>>>> separate files for easier maintainability, having everything in a\n>>>>> single file is just a mess and makes the whole thing more complicated\n>>>>> than it needs to be.  This is a bit of a baby step towards breaking it\n>>>>> up for easier maintenance.\n>>>> The question is if easier maintenance and development by spliting\n>>>> gitweb for developers offsets ease of install for users.\n>>> This would just get dropped into the same location that gitweb.cgi \n>>> exists in, there is no real difference in installation, and thus I can't \n>>> see this as an issue for users.\n>> To be more exact you have to know that you have to drop _generated files_,\n>> which means (for this version of patch) gitweb.cgi and gitweb_defaults.pl\n>> (or whatever the generated file with config variables would be named).\n>>\n>>\n>> ATTENTION!\n> \n> You didn't have to shout.\n> \n> Any progress on this front?\n\nSadly, no.  Busy weekend and a need to get some of the kernel.org \nservers upgraded has taken some precedence.  I should be circling back \naround on this tomorrow I think.\n\n> Not that I am anxious to queue new topics to 'next' right now (we are\n> frozen for 1.6.6), but I think having what is proven to work well at a\n> real site like k.org is much better than waiting for an unproven\n> reimplementation using somebody else's framework only for your theoretical\n> cleanliness.  John has better things to do than doing such a rewrite\n> himself, and even if you helped the process by producing a competing\n> caching scheme based on existing web caching engines, the aggregated\n> result (not just the web caching engine you base your work on) needs to\n> get a similar field exposure to prove itself that it can scale to the load\n> k.org sees, which would be quite a lot of work, no?\n"},{"id":"129978","messageId":"200912160322.28146.jnareb@gmail.com","threadId":"21933","inReplyTo":"7v8wd3ww4d.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-16T02:22:27Z","receivedAt":"2009-12-16T02:22:27Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 16 Dec 2009, Junio C Hamano wrote:\n\n> Not that I am anxious to queue new topics to 'next' right now (we are\n> frozen for 1.6.6), but I think having what is proven to work well at a\n> real site like k.org is much better than waiting for an unproven\n> reimplementation using somebody else's framework only for your theoretical\n> cleanliness.  John has better things to do than doing such a rewrite\n> himself, and even if you helped the process by producing a competing\n> caching scheme based on existing web caching engines, the aggregated\n> result (not just the web caching engine you base your work on) needs to\n> get a similar field exposure to prove itself that it can scale to the load\n> k.org sees, which would be quite a lot of work, no?\n\nI'm not against (well, not much against) custom caching that kernel.org\nuses, but I am against large change to gitweb code currently accompanying\ncaching, namely gather then output solution, which would negatively \naffect performance when caching is turned off.\n\nAlso I'd like to have caching code (the one that didn't made it to git\nmailing list for some reason, probably vger anti-SPAM filter) cleaned up\nfor submission: remove commented-out code, reduce code duplication, \nseparate dealing with orthogonal issues (cache itself, adaptivity of cache,\nbackground generation and 'in progress' info, generating key for cache\n(and improve key generation to include path_info / use %input_params)),\nfollow the same style that gitweb itself uses.\n\nAs for the \"[PATCH 6/6] GITWEB - Separate defaults from main file\" patch,\nit would require modifying gitweb tests to use generated gitweb/gitweb.cgi\nrather than source gitweb/gitweb.perl.\n\n\nAs for having caching code tested by git.kernel.org: IIRC there was issue\nwith it not having cache expiration thus gathering GB of cached data.\n-- \nJakub Narebski\nPoland\n"},{"id":"129998","messageId":"200912162052.09470.jnareb@gmail.com","threadId":"21933","inReplyTo":"4B283F3D.3020209@kernel.org","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-16T19:52:08Z","receivedAt":"2009-12-16T19:52:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Tue, 15 Dec 2009, 18:00 -0800, J.H. wrote:\n> Junio C Hamano wrote:\n\n> > Any progress on this front?\n> \n> Sadly, no.  Busy weekend and a need to get some of the kernel.org \n> servers upgraded has taken some precedence.  I should be circling back \n> around on this tomorrow I think.\n\nSo should I wait for reroll with proposals for improvements (modified \npatches)?\n\n-- \nJakub Narebski\nPoland\n"},{"id":"129999","messageId":"4B293D66.4000609@kernel.org","threadId":"21933","inReplyTo":"200912162052.09470.jnareb@gmail.com","subject":"Re: [PATCH 6/6] GITWEB - Separate defaults from main file","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2009-12-16T20:04:54Z","receivedAt":"2009-12-16T20:04:54Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"Jakub Narebski wrote:\n> On Tue, 15 Dec 2009, 18:00 -0800, J.H. wrote:\n>> Junio C Hamano wrote:\n> \n>>> Any progress on this front?\n>> Sadly, no.  Busy weekend and a need to get some of the kernel.org \n>> servers upgraded has taken some precedence.  I should be circling back \n>> around on this tomorrow I think.\n> \n> So should I wait for reroll with proposals for improvements (modified \n> patches)?\n\nI'd probably wait, though it's starting to look like if I get to gitweb \ntoday it will be this evening as I ventured off into getting the last 6 \nof the kernel.org servers upgraded.  Either way I will have a new patch \nseries and some changes in my own git tree shortly.\n\n- John 'Warthog9' Hawley\n"},{"id":"130077","messageId":"200912181736.07008.jnareb@gmail.com","threadId":"21933","inReplyTo":"200912111109.17047.jnareb@gmail.com","subject":"[PATCHv2 1/6] gitweb: Load checking","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-18T16:36:04Z","receivedAt":"2009-12-18T16:36:04Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThis changes slightly the behavior of gitweb, so that it verifies\nthat the box isn't inundated with before attempting to serve gitweb.\nIf the box is overloaded, it basically returns a 503 Server Unavailable\nuntil the load falls below the defined threshold.  This helps dramatically\nif you have a box that's I/O bound, reaches a certain load and you\ndon't want gitweb, the I/O hog that it is, increasing the pain the\nserver is already undergoing.\n\nThis behavior is controlled by $maxload configuration variable.\nDefault is a load of 300, which for most cases should never be hit.\nUnset it (set it to undefined value, i.e. undef) to turn off checking.\n\nCurrently it requires that '/proc/loadavg' file exists, otherwise the\nload check is bypassed (load is taken to be 0).  So platforms that do\nnot implement '/proc/loadavg' currently cannot use this feature.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis is my take on this patch, with all my concerns taken into \nconsideration... well, all except describing alterante approaches\nto straight using /proc/loadavg.\n\nDifferences to original version by John 'Warthog9' Hawley (J.H.):\n* Slightly improved wording in commit message and in comments\n* $maxload described in gitweb/README, in \"Gitweb config file variables\"\n  section\n* You can use '$maxload = undef;' to turn off load checking\n* Error page for too high load is generated using die_error, which had\n  to be extended to handle 503 Service Unavailable HTTP error code\n\n gitweb/README      |    7 ++++++-\n gitweb/gitweb.perl |   39 +++++++++++++++++++++++++++++++++++----\n 2 files changed, 41 insertions(+), 5 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex e34ee79..6c2c8e1 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -174,7 +174,7 @@ not include variables usually directly set during build):\n    Base URL for relative URLs in pages generated by gitweb,\n    (e.g. $logo, $favicon, @stylesheets if they are relative URLs),\n    needed and used only for URLs with nonempty PATH_INFO via\n-   <base href=\"$base_url>.  Usually gitweb sets its value correctly,\n+   <base href=\"$base_url\">.  Usually gitweb sets its value correctly,\n    and there is no need to set this variable, e.g. to $my_uri or \"/\".\n  * $home_link\n    Target of the home link on top of all pages (the first part of view\n@@ -228,6 +228,11 @@ not include variables usually directly set during build):\n    repositories from launching cross-site scripting (XSS) attacks.  Set this\n    to true if you don't trust the content of your repositories. The default\n    is false.\n+ * $maxload\n+   Used to set the maximum load that we will still respond to gitweb queries.\n+   If server load exceed this value then return \"503 Service Unavaliable\" error.\n+   Server load is taken to be 0 if gitweb cannot determine its value.  Set it to\n+   undefined value to turn it off.  The default is 300.\n \n \n Projects list file format\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 7e477af..a0f0444 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -221,6 +221,12 @@ our %avatar_size = (\n \t'double'  => 32\n );\n \n+# Used to set the maximum load that we will still respond to gitweb queries.\n+# If server load exceed this value then return \"503 server busy\" error.\n+# If gitweb cannot determined server load, it is taken to be 0.\n+# Leave it undefined (or set to 'undef') to turn off load checking.\n+our $maxload = 300;\n+\n # You define site-wide feature defaults here; override them with\n # $GITWEB_CONFIG as necessary.\n our %feature = (\n@@ -551,6 +557,26 @@ if (-e $GITWEB_CONFIG) {\n \tdo $GITWEB_CONFIG_SYSTEM if -e $GITWEB_CONFIG_SYSTEM;\n }\n \n+# Get loadavg of system, to compare against $maxload.\n+# Currently it requires '/proc/loadavg' present to get loadavg;\n+# if it is not present it returns 0, which means no load checking.\n+sub get_loadavg {\n+\topen my $fd, '<', '/proc/loadavg'\n+\t\tor return 0;\n+\tmy @load = split(/\\s+/, scalar <$fd>);\n+\tclose $fd;\n+\n+\t# The first three columns measure CPU and IO utilization of the last one,\n+\t# five, and 10 minute periods.  The fourth column shows the number of\n+\t# currently running processes and the total number of processes in the m/n\n+\t# format.  The last column displays the last process ID used.\n+\treturn $load[0] || 0;\n+}\n+\n+if (defined $maxload && get_loadavg() > $maxload) {\n+\tdie_error(503, \"The load average on the server is too high\");\n+}\n+\n # version of the core git binary\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n $number_of_git_cmds++;\n@@ -3354,14 +3380,19 @@ sub git_footer_html {\n # 500: The server isn't configured properly, or\n #      an internal error occurred (e.g. failed assertions caused by bugs), or\n #      an unknown error occurred (e.g. the git binary died unexpectedly).\n+# 503: The server is currently unavailable (because it is overloaded,\n+#      or down for maintenance).  Generally, this is a temporary state.\n sub die_error {\n \tmy $status = shift || 500;\n \tmy $error = shift || \"Internal server error\";\n \n-\tmy %http_responses = (400 => '400 Bad Request',\n-\t\t\t      403 => '403 Forbidden',\n-\t\t\t      404 => '404 Not Found',\n-\t\t\t      500 => '500 Internal Server Error');\n+\tmy %http_responses = (\n+\t\t400 => '400 Bad Request',\n+\t\t403 => '403 Forbidden',\n+\t\t404 => '404 Not Found',\n+\t\t500 => '500 Internal Server Error',\n+\t\t503 => '503 Service Unavailable',\n+\t);\n \tgit_header_html($http_responses{$status});\n \tprint <<EOF;\n <div class=\"page_body\">\n-- \n1.6.5.3\n"},{"id":"130088","messageId":"1261163938-10664-1-git-send-email-jnareb@gmail.com","threadId":"21933","inReplyTo":"m3y6l9dbop.fsf@localhost.localdomain","subject":"[RFC/PATCHv2 2/6] gitweb: Add option to force version match","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-18T19:18:58Z","receivedAt":"2009-12-18T19:18:58Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThis adds $git_versions_must_match variable, which is set to true\nvalue checks that we are running on the same version of git that we\nshipped with, and if not throw '500 Internal Server Error' error.\nWhat is checked is the version of gitweb (embedded in building\ngitweb.cgi), against version of runtime git binary used.\n\nGitweb can usually run with a mismatched git install.  This is more\nhere to give an obvious warning as to whats going on vs. silently\nfailing.\n\nBy default this feature is turned off.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nI don't quite see the reason behind such option, and I think that\nerror (instead of for example warning) on version mismatch is too much.\n\nThis is an RFC because formatting of error page is a bit rough, and\n(ab)uses exist CSS classes instead of creating new classnames for\nsemantic markup.\n\nDifferences from original version, by J.H.:\n* Changed name and flipped meaning of config variable, from\n  $missmatch_git to $git_versions_must_match\n* $git_versions_must_match is boolean flag - do not compare with an\n  empty string.\n* Changed error message a bit, fixed style, added entry in README\n\n gitweb/README      |    3 +++\n gitweb/gitweb.perl |   33 +++++++++++++++++++++++++++++++++\n 2 files changed, 36 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex 6c2c8e1..608b0f8 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -233,6 +233,9 @@ not include variables usually directly set during build):\n    If server load exceed this value then return \"503 Service Unavaliable\" error.\n    Server load is taken to be 0 if gitweb cannot determine its value.  Set it to\n    undefined value to turn it off.  The default is 300.\n+ * $git_versions_must_match\n+   If set, gitweb fails with 500 Internal Server Error if the version of gitweb\n+   doesn't match version of git binary.  The default is false.\n \n \n Projects list file format\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 3222131..b9bd865 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -221,6 +221,9 @@ our %avatar_size = (\n \t'double'  => 32\n );\n \n+# If it is true, exit if gitweb version and git binary version don't match\n+our $git_versions_must_match = 0;\n+\n # Used to set the maximum load that we will still respond to gitweb queries.\n # If server load exceed this value then return \"503 server busy\" error.\n # If gitweb cannot determined server load, it is taken to be 0.\n@@ -581,6 +584,36 @@ if (defined $maxload && get_loadavg() > $maxload) {\n our $git_version = qx(\"$GIT\" --version) =~ m/git version (.*)$/ ? $1 : \"unknown\";\n $number_of_git_cmds++;\n \n+# Throw an error if git versions does not match, if $git_versions_must_match is true.\n+if ($git_versions_must_match &&\n+    $git_version ne $version) {\n+\tgit_header_html('500 - Internal Server Error');\n+\tmy $admin_contact =\n+\t\tdefined $ENV{'SERVER_ADMIN'} ? \", $ENV{'SERVER_ADMIN'},\" : '';\n+\tprint <<\"EOT\";\n+<div class=\"page_body\">\n+<br /><br />\n+500 - Internal Server Error\n+<br />\n+</div>\n+<hr />\n+<div class=\"readme\">\n+<h1 align=\"center\">*** Warning ***</h1>\n+<p>\n+This version of gitweb was compiled for <b>@{[esc_html($version)]}</b>,\n+however git version <b>@{[esc_html($git_version)]}</b> was found on server,\n+and administrator requested strict version checking.\n+</p>\n+<p>\n+Please contact the server administrator${admin_contact} to either configure\n+gitweb to allow mismatched versions, or update git or gitweb installation.\n+</p>\n+</div>\n+EOT\n+\tgit_footer_html();\n+\texit;\n+}\n+\n $projects_list ||= $projectroot;\n \n # ======================================================================\n-- \n1.6.5.3\n"},{"id":"130096","messageId":"1261170166-14088-1-git-send-email-jnareb@gmail.com","threadId":"21933","inReplyTo":"m3tyvxd3pr.fsf@localhost.localdomain","subject":"[PATCHv2 3/6] gitweb: Optionally add \"git\" links in project list page","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-18T21:02:46Z","receivedAt":"2009-12-18T21:02:46Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThis adds a \"git\" link for each project in the project list page,\nshould a common $gitlinkurl_base be defined and not empty.  The full\nURL of each link is composed of $gitlinkurl_base and project name.\nIt is intended for git:// links, and in fact GITWEB_BASE_URL build\nvariable is used as its default value only if it starts with git://\n\nThis does make the assumption that the git repositories share a common\npath.  Nothing to date is known to actually make use of introduced\nlink.\n\nCreated \"git\" link follows rel=vcs-* microformat specification:\n  http://kitenet.net/~joey/rfc/rel-vcs/\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nI think it might be good idea... but for the fact \"Nothing to date is\nknown to actually make use of introduced link\".  What's its intended\nuse?\n\nDifferences to original version by John 'Warthog9' Hawley (J.H.):\n* It doesn't cause syntax error ;-)\n* Escaping of attribute value is left to CGI.pm\n* $gitlinkurl got renamed to $gitlinkurl_base, now includes git://\n  prefix, and defaults to GITWEB_BASE_URL if it begins with git://\n* Added description to gitweb/README\n* Uses rel=vcs-* microformat by Joey Hess\n\nI assume that nobody sane would define $gitlinkurl_base to \"0\"...\n\n gitweb/README      |    4 ++++\n gitweb/gitweb.perl |    8 ++++++++\n 2 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/README b/gitweb/README\nindex 608b0f8..36fb059 100644\n--- a/gitweb/README\n+++ b/gitweb/README\n@@ -71,6 +71,7 @@ You can specify the following configuration variables when building GIT:\n  * GITWEB_BASE_URL\n    Git base URLs used for URL to where fetch project from, i.e. full\n    URL is \"$git_base_url/$project\".  Shown on projects summary page.\n+   If it begins with \"git://\" it is also used for $gitlinkurl_base, see below.\n    Repository URL for project can be also configured per repository; this\n    takes precedence over URLs composed from base URL and a project name.\n    Note that you can setup multiple base URLs (for example one for\n@@ -204,6 +205,9 @@ not include variables usually directly set during build):\n    access, and one for http:// \"dumb\" protocol access).  Note that per\n    repository configuration in 'cloneurl' file, or as values of gitweb.url\n    project config.\n+ * $gitlinkurl_base\n+   Git base URL used (if it is defined and not empty) for \"git\" link in\n+   projects list, for each project.  Full URL is \"$gitlinkurl_base/$project\".\n  * $default_blob_plain_mimetype\n    Default mimetype for blob_plain (raw) view, if mimetype checking\n    doesn't result in some other type; by default 'text/plain'.\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b9bd865..efb6471 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -224,6 +224,10 @@ our %avatar_size = (\n # If it is true, exit if gitweb version and git binary version don't match\n our $git_versions_must_match = 0;\n \n+# If this variable is set and not empty, add an extra link called \"git\"\n+# for each project in project list.  Full URL is \"$gitlinkurl_base/$project\".\n+our $gitlinkurl_base = (\"++GITWEB_BASE_URL++\" =~ m!^(git://.*)$!) ? $1 : '';\n+\n # Used to set the maximum load that we will still respond to gitweb queries.\n # If server load exceed this value then return \"503 server busy\" error.\n # If gitweb cannot determined server load, it is taken to be 0.\n@@ -4472,6 +4476,10 @@ sub git_project_list_body {\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"log\")}, \"log\") . \" | \" .\n \t\t      $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"tree\")}, \"tree\") .\n \t\t      ($pr->{'forks'} ? \" | \" . $cgi->a({-href => href(project=>$pr->{'path'}, action=>\"forks\")}, \"forks\") : '') .\n+\t\t      ($gitlinkurl_base ?\n+\t\t       \" | \" . $cgi->a({-href=>\"$gitlinkurl_base/$pr->{'path'}\",\n+\t\t                        -rel=>\"vcs-git\"}, \"git\")\n+\t\t      : '') .\n \t\t      \"</td>\\n\" .\n \t\t      \"</tr>\\n\";\n \t}\n-- \n1.6.5.3\n"},{"id":"130139","messageId":"200912191432.12280.jnareb@gmail.com","threadId":"21933","inReplyTo":"200912111741.51760.jnareb@gmail.com","subject":"[PATCH/RFCv2 4/6] gitweb: Makefile improvements","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-12-19T13:32:11Z","receivedAt":"2009-12-19T13:32:11Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"From: John 'Warthog9' Hawley <warthog9@kernel.org>\n\nThis commit adjust the main Makefile so you can simply run\n\n     make gitweb\n\nwhich in turn calls gitweb/Makefile.  This means that in order to\ngenerate gitweb, you can simply run 'make' from gitweb subdirectory:\n\n     cd gitweb\n     make\n\nTargets gitweb/gitweb.cgi and (dependent on JSMIN being defined)\ngitweb/gitweb.min.js in main Makefile are preserved for backward\ncompatibility.\n\nSigned-off-by: John 'Warthog9' Hawley <warthog9@kernel.org>\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis implements separate Makefile for gitweb, with main Makefile calling\nit, like for gitk-git/, git-gui/, Documentation/, t/, and templates/\ndirectories.\n\nIt is marked as RFC because I don't feel that my make-fu is strong enough\nto be sure that there are no errors / mistakes.  Very slightly tested.\n\n Makefile        |   64 +++++----------------------\n gitweb/Makefile |  129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 141 insertions(+), 52 deletions(-)\n create mode 100644 gitweb/Makefile\n\ndiff --git a/Makefile b/Makefile\nindex 4a1e5bc..50d815e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -280,29 +280,6 @@ pathsep = :\n # JavaScript minifier invocation that can function as filter\n JSMIN =\n \n-# default configuration for gitweb\n-GITWEB_CONFIG = gitweb_config.perl\n-GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf\n-GITWEB_HOME_LINK_STR = projects\n-GITWEB_SITENAME =\n-GITWEB_PROJECTROOT = /pub/git\n-GITWEB_PROJECT_MAXDEPTH = 2007\n-GITWEB_EXPORT_OK =\n-GITWEB_STRICT_EXPORT =\n-GITWEB_BASE_URL =\n-GITWEB_LIST =\n-GITWEB_HOMETEXT = indextext.html\n-GITWEB_CSS = gitweb.css\n-GITWEB_LOGO = git-logo.png\n-GITWEB_FAVICON = git-favicon.png\n-ifdef JSMIN\n-GITWEB_JS = gitweb.min.js\n-else\n-GITWEB_JS = gitweb.js\n-endif\n-GITWEB_SITE_HEADER =\n-GITWEB_SITE_FOOTER =\n-\n export prefix bindir sharedir sysconfdir\n \n CC = gcc\n@@ -1509,6 +1486,11 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \n+\n+.PHONY: gitweb\n+gitweb:\n+\t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all\n+\n ifdef JSMIN\n OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js\n gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js\n@@ -1516,30 +1498,13 @@ else\n OTHER_PROGRAMS += gitweb/gitweb.cgi\n gitweb/gitweb.cgi: gitweb/gitweb.perl\n endif\n-\t$(QUIET_GEN)$(RM) $@ $@+ && \\\n-\tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n-\t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n-\t    -e 's|++GIT_BINDIR++|$(bindir)|g' \\\n-\t    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \\\n-\t    -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \\\n-\t    -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \\\n-\t    -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \\\n-\t    -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \\\n-\t    -e 's|\"++GITWEB_PROJECT_MAXDEPTH++\"|$(GITWEB_PROJECT_MAXDEPTH)|g' \\\n-\t    -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \\\n-\t    -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \\\n-\t    -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \\\n-\t    -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \\\n-\t    -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \\\n-\t    -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \\\n-\t    -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \\\n-\t    -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \\\n-\t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n-\t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n-\t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n-\t    $< >$@+ && \\\n-\tchmod +x $@+ && \\\n-\tmv $@+ $@\n+\t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n+\n+ifdef JSMIN\n+gitweb/gitweb.min.js: gitweb/gitweb.js\n+\t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n+endif # JSMIN\n+\n \n git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n@@ -1566,11 +1531,6 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)) git-instaweb: % : unimplemented.sh\n \tmv $@+ $@\n endif # NO_PERL\n \n-ifdef JSMIN\n-gitweb/gitweb.min.js: gitweb/gitweb.js\n-\t$(QUIET_GEN)$(JSMIN) <$< >$@\n-endif # JSMIN\n-\n configure: configure.ac\n \t$(QUIET_GEN)$(RM) $@ $<+ && \\\n \tsed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nnew file mode 100644\nindex 0000000..c9eb1ee\n--- /dev/null\n+++ b/gitweb/Makefile\n@@ -0,0 +1,129 @@\n+# The default target of this Makefile is...\n+all::\n+\n+# Define V=1 to have a more verbose compile.\n+#\n+# Define JSMIN to point to JavaScript minifier that functions as\n+# a filter to have gitweb.js minified.\n+#\n+\n+prefix ?= $(HOME)\n+bindir ?= $(prefix)/bin\n+RM ?= rm -f\n+\n+# JavaScript minifier invocation that can function as filter\n+JSMIN ?=\n+\n+# default configuration for gitweb\n+GITWEB_CONFIG = gitweb_config.perl\n+GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf\n+GITWEB_HOME_LINK_STR = projects\n+GITWEB_SITENAME =\n+GITWEB_PROJECTROOT = /pub/git\n+GITWEB_PROJECT_MAXDEPTH = 2007\n+GITWEB_EXPORT_OK =\n+GITWEB_STRICT_EXPORT =\n+GITWEB_BASE_URL =\n+GITWEB_LIST =\n+GITWEB_HOMETEXT = indextext.html\n+GITWEB_CSS = gitweb.css\n+GITWEB_LOGO = git-logo.png\n+GITWEB_FAVICON = git-favicon.png\n+ifdef JSMIN\n+GITWEB_JS = gitweb.min.js\n+else\n+GITWEB_JS = gitweb.js\n+endif\n+GITWEB_SITE_HEADER =\n+GITWEB_SITE_FOOTER =\n+\n+# include user config\n+-include ../config.mak.autogen\n+-include ../config.mak\n+\n+# determine version\n+../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n+\t$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE\n+\n+-include ../GIT-VERSION-FILE\n+\n+### Build rules\n+\n+SHELL_PATH ?= $(SHELL)\n+PERL_PATH  ?= /usr/bin/perl\n+\n+# Shell quote;\n+bindir_SQ = $(subst ','\\'',$(bindir))         #'\n+SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH)) #'\n+PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))  #'\n+\n+# Quiet generation (unless V=1)\n+QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir\n+QUIET_SUBDIR1  =\n+\n+ifneq ($(findstring $(MAKEFLAGS),w),w)\n+PRINT_DIR = --no-print-directory\n+else # \"make -w\"\n+NO_SUBDIR = :\n+endif\n+\n+ifneq ($(findstring $(MAKEFLAGS),s),s)\n+ifndef V\n+\tQUIET          = @\n+\tQUIET_GEN      = $(QUIET)echo '   ' GEN $@;\n+\tQUIET_SUBDIR0  = +@subdir=\n+\tQUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \\\n+\t                 $(MAKE) $(PRINT_DIR) -C $$subdir\n+\texport V\n+\texport QUIET\n+\texport QUIET_GEN\n+\texport QUIET_SUBDIR0\n+\texport QUIET_SUBDIR1\n+endif\n+endif\n+\n+all:: gitweb.cgi\n+\n+ifdef JSMIN\n+FILES=gitweb.cgi gitweb.min.js\n+gitweb.cgi: gitweb.perl gitweb.min.js\n+else # !JSMIN\n+FILES=gitweb.cgi\n+gitweb.cgi: gitweb.perl\n+endif # JSMIN\n+\n+gitweb.cgi:\n+\t$(QUIET_GEN)$(RM) $@ $@+ && \\\n+\tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n+\t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n+\t    -e 's|++GIT_BINDIR++|$(bindir)|g' \\\n+\t    -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \\\n+\t    -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \\\n+\t    -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \\\n+\t    -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \\\n+\t    -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \\\n+\t    -e 's|\"++GITWEB_PROJECT_MAXDEPTH++\"|$(GITWEB_PROJECT_MAXDEPTH)|g' \\\n+\t    -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \\\n+\t    -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \\\n+\t    -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \\\n+\t    -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \\\n+\t    -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \\\n+\t    -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \\\n+\t    -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \\\n+\t    -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \\\n+\t    -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \\\n+\t    -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \\\n+\t    -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \\\n+\t    $< >$@+ && \\\n+\tchmod +x $@+ && \\\n+\tmv $@+ $@\n+\n+ifdef JSMIN\n+gitweb.min.js: gitweb.js\n+\t$(QUIET_GEN)$(JSMIN) <$< >$@\n+endif # JSMIN\n+\n+clean:\n+\t$(RM) $(FILES)\n+\n+.PHONY: all clean .FORCE-GIT-VERSION-FILE\n-- \n1.6.5.3\n"}]}