[PATCH] gitweb: require $ENV{'GITWEB_CONFIG'}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Matthias Lederhofer <matled@xxxxxxx>
---
With this patch it is possible to use gitweb.perl for developing by
loading the configuration from $GITWEB_CONFIG.  This might also be
useful for normal usage of gitweb.  Example:
% cat cfg 
$GIT = '/usr/bin/git';
$projectroot = '/home/matled/src/git';
$projects_list = '/home/matled/src/git/git/gitweb/list';
% cat run
#!/bin/sh
export GATEWAY_INTERFACE="CGI/1.1"
export HTTP_ACCEPT="*/*"
export REQUEST_METHOD="GET"
export GITWEB_CONFIG='./cfg'
export QUERY_STRING=""$1""
exec ./gitweb.perl
% time ./run p=git/.git > /dev/null 
./run p=git/.git > /dev/null  0.47s user 0.58s system 102% cpu 1.025
total

This makes it easy to check for warnings and do performance tests
after changes, you can also pipe this to lynx -dump -force-html
/dev/stdin to get more than just html :)

This also documents the original patch adding require $GITWEB_CONFIG.
---
 gitweb/README      |    5 +++++
 gitweb/gitweb.perl |    4 ++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/gitweb/README b/gitweb/README
index b91d42a..dc4b850 100644
--- a/gitweb/README
+++ b/gitweb/README
@@ -23,6 +23,11 @@ You can specify the following configurat
    Points to the location where you put gitweb.css on your web server.
  * GITWEB_LOGO
    Points to the location where you put git-logo.png on your web server.
+ * GITWEB_CONFIG
+   This file will be loaded using 'require'.  If the environment
+   $GITWEB_CONFIG is set when gitweb.cgi is executed the file in the
+   environment variable will be loaded additionally (after) the file
+   specified when gitweb.cgi was created.
 
 Originally written by:
   Kay Sievers <kay.sievers@xxxxxxxx>
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index f4c0d87..efcc926 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -63,6 +63,10 @@ our $mimetypes_file = undef;
 our $GITWEB_CONFIG = '@@GITWEB_CONFIG@@';
 require $GITWEB_CONFIG if -e $GITWEB_CONFIG;
 
+if (defined($ENV{'GITWEB_CONFIG'}) && -e $ENV{'GITWEB_CONFIG'}) {
+	require $ENV{'GITWEB_CONFIG'};
+}
+
 # version of the core git binary
 our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
 
-- 
1.4.2.rc2.g4713

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]