{"thread":{"id":"4676","subject":"[PATCH/RFC] Add git-instaweb, instantly browse the working repo with gitweb","startedAt":"2006-06-27T09:05:30Z","lastAt":"2006-07-01T22:51:30Z","messageCount":4,"participants":["Eric Wong","Junio C Hamano","Bertrand Jacquin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22651","messageId":"11513991301372-git-send-email-normalperson@yhbt.net","threadId":"4676","inReplyTo":null,"subject":"[PATCH/RFC] Add git-instaweb, instantly browse the working repo with gitweb","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-06-27T09:05:30Z","receivedAt":"2006-06-27T09:05:30Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I got tired of having to configure gitweb for every repository\nI work on.  I sometimes prefer gitweb to standard GUIs like gitk\nor gitview; so this lets me automatically configure gitweb to\nbrowse my working repository and also opens my browser to it.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n .gitignore                     |    1 \n Documentation/git-instaweb.txt |   84 ++++++++++++++++\n Makefile                       |   16 +++\n git-instaweb.sh                |  206 ++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 306 insertions(+), 1 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 7b954d5..2bcc604 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -46,6 +46,7 @@ git-http-push\n git-imap-send\n git-index-pack\n git-init-db\n+git-instaweb\n git-local-fetch\n git-log\n git-lost-found\ndiff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt\nnew file mode 100644\nindex 0000000..7dd393b\n--- /dev/null\n+++ b/Documentation/git-instaweb.txt\n@@ -0,0 +1,84 @@\n+git-instaweb(1)\n+===============\n+\n+NAME\n+----\n+git-instaweb - instantly browse your working repository in gitweb\n+\n+SYNOPSIS\n+--------\n+'git-instaweb' [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n+\n+'git-instaweb' [--start] [--stop] [--restart]\n+\n+DESCRIPTION\n+-----------\n+A simple script to setup gitweb and a web server for browsing the local\n+repository.\n+\n+OPTIONS\n+-------\n+\n+-l|--local::\n+\tOnly bind the web server to the local IP (127.0.0.1).\n+\n+-d|--httpd::\n+\tThe HTTP daemon command-line that will be executed.\n+\tCommand-line options may be specified here, and the\n+\tconfiguration file will be added at the end of the command-line.\n+\tCurrently, lighttpd and apache2 are the only supported servers.\n+\t(Default: lighttpd)\n+\n+-m|--module-path::\n+\tThe module path (only needed if httpd is Apache).\n+\t(Default: /usr/lib/apache2/modules)\n+\n+-p|--port::\n+\tThe port number to bind the httpd to.  (Default: 1234)\n+\n+-b|--browser::\n+\n+\tThe web browser command-line to execute to view the gitweb page.\n+\tIf blank, the URL of the gitweb instance will be printed to\n+\tstdout.  (Default: 'firefox')\n+\n+--start::\n+\tStart the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance.\n+\n+--stop::\n+\tStop the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance,\n+\tnor does it close the browser.\n+\n+--restart::\n+\tRestart the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance.\n+\n+CONFIGURATION\n+-------------\n+\n+You may specify configuration in your .git/config\n+\n+-----------------------------------------------------------------------\n+[instaweb]\n+\tlocal = true\n+\thttpd = apache2 -f\n+\tport = 4321\n+\tbrowser = konqueror\n+\tmodulepath = /usr/lib/apache2/modules\n+\n+-----------------------------------------------------------------------\n+\n+Author\n+------\n+Written by Eric Wong <normalperson@yhbt.net>\n+\n+Documentation\n+--------------\n+Documentation by Eric Wong <normalperson@yhbt.net>.\n+\n+GIT\n+---\n+Part of the gitlink:git[7] suite\n+\ndiff --git a/Makefile b/Makefile\nindex cde619c..83d8922 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -142,7 +142,7 @@ SCRIPT_PYTHON = \\\n SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \\\n \t  $(patsubst %.perl,%,$(SCRIPT_PERL)) \\\n \t  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \\\n-\t  git-cherry-pick git-status\n+\t  git-cherry-pick git-status git-instaweb\n \n # The ones that do not have to link with lcrypto, lz nor xdiff.\n SIMPLE_PROGRAMS = \\\n@@ -545,6 +545,20 @@ git-status: git-commit\n \tcp $< $@+\n \tmv $@+ $@\n \n+git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css\n+\trm -f $@ $@+\n+\tsed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n+\t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n+\t    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \\\n+\t    -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \\\n+\t    $@.sh | sed \\\n+\t    -e 's|@@GITWEB_CGI@@|#!$(PERL_PATH_SQ)|; T; r gitweb/gitweb.cgi' \\\n+\t    | sed \\\n+\t    -e 's|@@GITWEB_CSS@@||; T; r gitweb/gitweb.css' \\\n+\t    > $@+\n+\tchmod +x $@+\n+\tmv $@+ $@\n+\n # These can record GIT_VERSION\n git$X git.spec \\\n \t$(patsubst %.sh,%,$(SCRIPT_SH)) \\\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nnew file mode 100755\nindex 0000000..8f4b2df\n--- /dev/null\n+++ b/git-instaweb.sh\n@@ -0,0 +1,206 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2006 Eric Wong\n+#\n+USAGE='[--start] [--stop] [--restart]\n+  [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n+  [--module-path=<path> (for Apache2 only)]'\n+\n+. git-sh-setup\n+\n+if echo $GIT_DIR | grep ^/\n+then\n+\tfqgitdir=\"$GIT_DIR\"\n+else\n+\tfqgitdir=\"$PWD/$GIT_DIR\"\n+fi\n+\n+local=\"`git repo-config --bool --get instaweb.local`\"\n+httpd=\"`git repo-config --get instaweb.httpd`\"\n+browser=\"`git repo-config --get instaweb.browser`\"\n+port=`git repo-config --get instaweb.port`\n+module_path=\"`git repo-config --get instaweb.modulepath`\"\n+\n+conf=$GIT_DIR/gitweb/httpd.conf\n+\n+# Defaults:\n+\n+# if installed, it doesn't need further configuration (module_path)\n+test -z \"$httpd\" && httpd='lighttpd -f'\n+\n+# probably the most popular browser among gitweb users\n+test -z \"$browser\" && browser='firefox'\n+\n+# any untaken local port will do...\n+test -z \"$port\" && port=1234\n+\n+start_httpd () {\n+\tif echo $httpd | grep ^/ >/dev/null || which $httpd >/dev/null\n+\tthen\n+\t\t$httpd $fqgitdir/gitweb/httpd.conf\n+\telse\n+\t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n+\t\t# these days and those are not in most users $PATHs\n+\t\thttpd_only=`echo $httpd | sed 's/ .*$//'`\n+\t\tfor i in /usr/local/sbin /usr/sbin\n+\t\tdo\n+\t\t\tif test -x \"$i/$httpd_only\"\n+\t\t\tthen\n+\t\t\t\t$i/$httpd $fqgitdir/gitweb/httpd.conf\n+\t\t\t\treturn\n+\t\t\tfi\n+\t\tdone\n+\tfi\n+}\n+\n+stop_httpd () {\n+\tif test -f \"$fqgitdir/pid\"\n+\tthen\n+\t\tkill `cat \"$fqgitdir/pid\"` 2>/dev/null\n+\tfi\n+}\n+\n+while case \"$#\" in 0) break ;; esac\n+do\n+\tcase \"$1\" in\n+\t--stop|stop)\n+\t\tstop_httpd\n+\t\texit 0\n+\t\t;;\n+\t--start|start)\n+\t\tstart_httpd\n+\t\texit 0\n+\t\t;;\n+\t--restart|restart)\n+\t\tstop_httpd\n+\t\tstart_httpd\n+\t\texit 0\n+\t\t;;\n+\t--local|-l)\n+\t\tlocal=true\n+\t\t;;\n+\t-d|--httpd|--httpd=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\thttpd=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\thttpd=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-b|--browser|--browser=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tbrowser=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tbrowser=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-p|--port|--port=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tport=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tport=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-m|--module-path=*|--module-path)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tmodule_path=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tmodule_path=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t*)\n+\t\tusage\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n+mkdir -p \"$GIT_DIR/gitweb/tmp\"\n+\n+lighttpd_conf () {\n+\tcat > \"$conf\" <<EOF\n+server.document-root = \"$fqgitdir/gitweb\"\n+server.port = $port\n+server.modules = ( \"mod_cgi\" )\n+server.indexfiles = ( \"gitweb.cgi\" )\n+server.pid-file = \"$fqgitdir/pid\"\n+cgi.assign = ( \".cgi\" => \"\" )\n+mimetype.assign = ( \".css\" => \"text/css\" )\n+EOF\n+\ttest \"$local\" = true && echo 'server.bind = \"127.0.0.1\"' >> \"$conf\"\n+}\n+\n+apache2_conf () {\n+\ttest -z \"$module_path\" && module_path=/usr/lib/apache2/modules\n+\tmkdir -p \"$GIT_DIR/gitweb/logs\"\n+\tbind=\n+\ttest -n \"$local\" = true && bind='127.0.0.1:'\n+\techo 'text/css css' > $fqgitdir/mime.types\n+\tcat > \"$conf\" <<EOF\n+ServerRoot \"$fqgitdir/gitweb\"\n+DocumentRoot \"$fqgitdir/gitweb\"\n+PidFile \"$fqgitdir/pid\"\n+Listen $bind$port\n+LoadModule cgi_module $module_path/mod_cgi.so\n+TypesConfig $fqgitdir/mime.types\n+DirectoryIndex gitweb.cgi\n+AddHandler cgi-script .cgi\n+<Location /gitweb.cgi>\n+\tOptions +ExecCGI\n+</Location>\n+EOF\n+}\n+\n+script='s#^my $projectroot =.*#my $projectroot = \"'`dirname $fqgitdir`'\";#;\n+s#my $gitbin =.*#my $gitbin = \"'`git --exec-path`'\";#;\n+s#my $projects_list =.*#my $projects_list = $projectroot;#;\n+s#my $git_temp =.*#my $git_temp = \"'$fqgitdir/gitweb/tmp'\";#'\n+\n+gitweb_cgi () {\n+\tcat > \"$1.tmp\" <<\\EOFGITWEB\n+@@GITWEB_CGI@@\n+EOFGITWEB\n+\tsed \"$script\" \"$1.tmp\"  > \"$1\"\n+\tchmod +x \"$1\"\n+\trm -f \"$1.tmp\"\n+}\n+\n+gitweb_css () {\n+\tcat > \"$1\" <<\\EOFGITWEB\n+@@GITWEB_CSS@@\n+EOFGITWEB\n+}\n+\n+gitweb_cgi $GIT_DIR/gitweb/gitweb.cgi\n+gitweb_css $GIT_DIR/gitweb/gitweb.css\n+\n+if echo \"$httpd\" | grep lighttpd >/dev/null\n+then\n+\tlighttpd_conf\n+elif echo \"$httpd\" | grep apache2 >/dev/null\n+then\n+\tapache2_conf\n+else\n+\techo \"Unknown httpd specified: $httpd\"\n+\texit 1\n+fi\n+\n+start_httpd\n+test -z \"$browser\" && browser=echo\n+$browser http://127.0.0.1:$port\n+\n-- \n1.4.1.rc1.g2faf-dirty\n"},{"id":"22942","messageId":"7vwtayh56z.fsf@assigned-by-dhcp.cox.net","threadId":"4676","inReplyTo":"11513991301372-git-send-email-normalperson@yhbt.net","subject":"Re: [PATCH/RFC] Add git-instaweb, instantly browse the working repo with gitweb","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-06-30T18:24:52Z","receivedAt":"2006-06-30T18:24:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> I got tired of having to configure gitweb for every repository\n> I work on.  I sometimes prefer gitweb to standard GUIs like gitk\n> or gitview; so this lets me automatically configure gitweb to\n> browse my working repository and also opens my browser to it.\n>\n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n\nThis is cute but I haven't seen much responses to it yet.  Are\npeople uninterested?\n"},{"id":"22996","messageId":"20060701221414.GA3366@soma","threadId":"4676","inReplyTo":"7vwtayh56z.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH/RFC (updated)] Add git-instaweb, instantly browse the working repo with gitweb","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-07-01T22:14:14Z","receivedAt":"2006-07-01T22:14:14Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I got tired of having to configure gitweb for every repository\nI work on.  I sometimes prefer gitweb to standard GUIs like gitk\nor gitview; so this lets me automatically configure gitweb to\nbrowse my working repository and also opens my browser to it.\n\nUpdates from the original patch:\n\nAdded Apache/mod_perl2 compatibility if Dennis Stosberg's gitweb\nhas been applied, too: <20060621130708.Gcbc6e5c@leonov.stosberg.net>\n\nGeneral cleanups in shell code usage.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n Junio C Hamano <junkio@cox.net> wrote:\n > Eric Wong <normalperson@yhbt.net> writes:\n > \n > > I got tired of having to configure gitweb for every repository\n > > I work on.  I sometimes prefer gitweb to standard GUIs like gitk\n > > or gitview; so this lets me automatically configure gitweb to\n > > browse my working repository and also opens my browser to it.\n > >\n > > Signed-off-by: Eric Wong <normalperson@yhbt.net>\n > \n > This is cute but I haven't seen much responses to it yet.  Are\n > people uninterested?\n\n I've found it very useful myself, but I wouldn't have made it if I\n didn't :)  It's somewhat of a strange and alien concept in GUIs, and\n will probably take some getting used to; but I think it can gain users\n quickly because it doesn't rely on any specific toolkits, and can be\n expanded to support more HTTP servers.\n \n If anything, it can also serve as short and simple documentation for\n setting up gitweb.\n\n .gitignore                     |    1 \n Documentation/git-instaweb.txt |   84 ++++++++++++++\n Makefile                       |   16 +++\n git-instaweb.sh                |  235 ++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 335 insertions(+), 1 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 7b954d5..2bcc604 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -46,6 +46,7 @@ git-http-push\n git-imap-send\n git-index-pack\n git-init-db\n+git-instaweb\n git-local-fetch\n git-log\n git-lost-found\ndiff --git a/Documentation/git-instaweb.txt b/Documentation/git-instaweb.txt\nnew file mode 100644\nindex 0000000..7dd393b\n--- /dev/null\n+++ b/Documentation/git-instaweb.txt\n@@ -0,0 +1,84 @@\n+git-instaweb(1)\n+===============\n+\n+NAME\n+----\n+git-instaweb - instantly browse your working repository in gitweb\n+\n+SYNOPSIS\n+--------\n+'git-instaweb' [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n+\n+'git-instaweb' [--start] [--stop] [--restart]\n+\n+DESCRIPTION\n+-----------\n+A simple script to setup gitweb and a web server for browsing the local\n+repository.\n+\n+OPTIONS\n+-------\n+\n+-l|--local::\n+\tOnly bind the web server to the local IP (127.0.0.1).\n+\n+-d|--httpd::\n+\tThe HTTP daemon command-line that will be executed.\n+\tCommand-line options may be specified here, and the\n+\tconfiguration file will be added at the end of the command-line.\n+\tCurrently, lighttpd and apache2 are the only supported servers.\n+\t(Default: lighttpd)\n+\n+-m|--module-path::\n+\tThe module path (only needed if httpd is Apache).\n+\t(Default: /usr/lib/apache2/modules)\n+\n+-p|--port::\n+\tThe port number to bind the httpd to.  (Default: 1234)\n+\n+-b|--browser::\n+\n+\tThe web browser command-line to execute to view the gitweb page.\n+\tIf blank, the URL of the gitweb instance will be printed to\n+\tstdout.  (Default: 'firefox')\n+\n+--start::\n+\tStart the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance.\n+\n+--stop::\n+\tStop the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance,\n+\tnor does it close the browser.\n+\n+--restart::\n+\tRestart the httpd instance and exit.  This does not generate\n+\tany of the configuration files for spawning a new instance.\n+\n+CONFIGURATION\n+-------------\n+\n+You may specify configuration in your .git/config\n+\n+-----------------------------------------------------------------------\n+[instaweb]\n+\tlocal = true\n+\thttpd = apache2 -f\n+\tport = 4321\n+\tbrowser = konqueror\n+\tmodulepath = /usr/lib/apache2/modules\n+\n+-----------------------------------------------------------------------\n+\n+Author\n+------\n+Written by Eric Wong <normalperson@yhbt.net>\n+\n+Documentation\n+--------------\n+Documentation by Eric Wong <normalperson@yhbt.net>.\n+\n+GIT\n+---\n+Part of the gitlink:git[7] suite\n+\ndiff --git a/Makefile b/Makefile\nindex cde619c..83d8922 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -142,7 +142,7 @@ SCRIPT_PYTHON = \\\n SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \\\n \t  $(patsubst %.perl,%,$(SCRIPT_PERL)) \\\n \t  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \\\n-\t  git-cherry-pick git-status\n+\t  git-cherry-pick git-status git-instaweb\n \n # The ones that do not have to link with lcrypto, lz nor xdiff.\n SIMPLE_PROGRAMS = \\\n@@ -545,6 +545,20 @@ git-status: git-commit\n \tcp $< $@+\n \tmv $@+ $@\n \n+git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css\n+\trm -f $@ $@+\n+\tsed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \\\n+\t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n+\t    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \\\n+\t    -e 's/@@NO_PYTHON@@/$(NO_PYTHON)/g' \\\n+\t    $@.sh | sed \\\n+\t    -e 's|@@GITWEB_CGI@@|#!$(PERL_PATH_SQ)|; T; r gitweb/gitweb.cgi' \\\n+\t    | sed \\\n+\t    -e 's|@@GITWEB_CSS@@||; T; r gitweb/gitweb.css' \\\n+\t    > $@+\n+\tchmod +x $@+\n+\tmv $@+ $@\n+\n # These can record GIT_VERSION\n git$X git.spec \\\n \t$(patsubst %.sh,%,$(SCRIPT_SH)) \\\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nnew file mode 100755\nindex 0000000..51067d9\n--- /dev/null\n+++ b/git-instaweb.sh\n@@ -0,0 +1,235 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2006 Eric Wong\n+#\n+USAGE='[--start] [--stop] [--restart]\n+  [--local] [--httpd=<httpd>] [--port=<port>] [--browser=<browser>]\n+  [--module-path=<path> (for Apache2 only)]'\n+\n+. git-sh-setup\n+\n+case \"$GIT_DIR\" in\n+/*)\n+\tfqgitdir=\"$GIT_DIR\" ;;\n+*)\n+\tfqgitdir=\"$PWD/$GIT_DIR\" ;;\n+esac\n+\n+local=\"`git repo-config --bool --get instaweb.local`\"\n+httpd=\"`git repo-config --get instaweb.httpd`\"\n+browser=\"`git repo-config --get instaweb.browser`\"\n+port=`git repo-config --get instaweb.port`\n+module_path=\"`git repo-config --get instaweb.modulepath`\"\n+\n+conf=$GIT_DIR/gitweb/httpd.conf\n+\n+# Defaults:\n+\n+# if installed, it doens't need further configuration (module_path)\n+test -z \"$httpd\" && httpd='lighttpd -f'\n+\n+# probably the most popular browser among gitweb users\n+test -z \"$browser\" && browser='firefox'\n+\n+# any untaken local port will do...\n+test -z \"$port\" && port=1234\n+\n+start_httpd () {\n+\thttpd_only=\"`echo $httpd | cut -f1 -d' '`\"\n+\tif test \"`expr index $httpd_only /`\" -eq '1' || \\\n+\t\t\t\twhich $httpd_only >/dev/null\n+\tthen\n+\t\t$httpd $fqgitdir/gitweb/httpd.conf\n+\telse\n+\t\t# many httpds are installed in /usr/sbin or /usr/local/sbin\n+\t\t# these days and those are not in most users $PATHs\n+\t\tfor i in /usr/local/sbin /usr/sbin\n+\t\tdo\n+\t\t\tif test -x \"$i/$httpd_only\"\n+\t\t\tthen\n+\t\t\t\t# don't quote $httpd, there can be\n+\t\t\t\t# arguments to it (-f)\n+\t\t\t\t$i/$httpd \"$fqgitdir/gitweb/httpd.conf\"\n+\t\t\t\treturn\n+\t\t\tfi\n+\t\tdone\n+\tfi\n+}\n+\n+stop_httpd () {\n+\ttest -f \"$fqgitdir/pid\" && kill `cat \"$fqgitdir/pid\"`\n+}\n+\n+while case \"$#\" in 0) break ;; esac\n+do\n+\tcase \"$1\" in\n+\t--stop|stop)\n+\t\tstop_httpd\n+\t\texit 0\n+\t\t;;\n+\t--start|start)\n+\t\tstart_httpd\n+\t\texit 0\n+\t\t;;\n+\t--restart|restart)\n+\t\tstop_httpd\n+\t\tstart_httpd\n+\t\texit 0\n+\t\t;;\n+\t--local|-l)\n+\t\tlocal=true\n+\t\t;;\n+\t-d|--httpd|--httpd=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\thttpd=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\thttpd=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-b|--browser|--browser=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tbrowser=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tbrowser=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-p|--port|--port=*)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tport=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tport=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t-m|--module-path=*|--module-path)\n+\t\tcase \"$#,$1\" in\n+\t\t*,*=*)\n+\t\t\tmodule_path=`expr \"$1\" : '-[^=]*=\\(.*\\)'` ;;\n+\t\t1,*)\n+\t\t\tusage ;;\n+\t\t*)\n+\t\t\tmodule_path=\"$2\"\n+\t\t\tshift ;;\n+\t\tesac\n+\t\t;;\n+\t*)\n+\t\tusage\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n+mkdir -p \"$GIT_DIR/gitweb/tmp\"\n+GIT_EXEC_PATH=\"`git --exec-path`\"\n+GIT_DIR=\"$fqgitdir\"\n+export GIT_EXEC_PATH GIT_DIR\n+\n+\n+lighttpd_conf () {\n+\tcat > \"$conf\" <<EOF\n+server.document-root = \"$fqgitdir/gitweb\"\n+server.port = $port\n+server.modules = ( \"mod_cgi\" )\n+server.indexfiles = ( \"gitweb.cgi\" )\n+server.pid-file = \"$fqgitdir/pid\"\n+cgi.assign = ( \".cgi\" => \"\" )\n+mimetype.assign = ( \".css\" => \"text/css\" )\n+EOF\n+\ttest \"$local\" = true && echo 'server.bind = \"127.0.0.1\"' >> \"$conf\"\n+}\n+\n+apache2_conf () {\n+\ttest -z \"$module_path\" && module_path=/usr/lib/apache2/modules\n+\tmkdir -p \"$GIT_DIR/gitweb/logs\"\n+\tbind=\n+\ttest \"$local\" = true && bind='127.0.0.1:'\n+\techo 'text/css css' > $fqgitdir/mime.types\n+\tcat > \"$conf\" <<EOF\n+ServerRoot \"$fqgitdir/gitweb\"\n+DocumentRoot \"$fqgitdir/gitweb\"\n+PidFile \"$fqgitdir/pid\"\n+Listen $bind$port\n+TypesConfig $fqgitdir/mime.types\n+DirectoryIndex gitweb.cgi\n+EOF\n+\n+\t# check to see if Dennis Stosberg's mod_perl compatibility patch\n+\t# (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied\n+\tif test -f \"$module_path/mod_perl.so\" && grep '^our $gitbin' \\\n+\t\t\t\t\"$GIT_DIR/gitweb/gitweb.cgi\" >/dev/null\n+\tthen\n+\t\t# favor mod_perl if available\n+\t\tcat >> \"$conf\" <<EOF\n+LoadModule perl_module $module_path/mod_perl.so\n+PerlPassEnv GIT_DIR\n+PerlPassEnv GIT_EXEC_DIR\n+<Location /gitweb.cgi>\n+\tSetHandler perl-script\n+\tPerlResponseHandler ModPerl::Registry\n+\tPerlOptions +ParseHeaders\n+\tOptions +ExecCGI\n+</Location>\n+EOF\n+\telse\n+\t\t# plain-old CGI\n+\t\tcat >> \"$conf\" <<EOF\n+LoadModule cgi_module $module_path/mod_cgi.so\n+AddHandler cgi-script .cgi\n+<Location /gitweb.cgi>\n+\tOptions +ExecCGI\n+</Location>\n+EOF\n+\tfi\n+}\n+\n+script='\n+s#^\\(my\\|our\\) $projectroot =.*#\\1 $projectroot = \"'`dirname $fqgitdir`'\";#;\n+s#\\(my\\|our\\) $gitbin =.*#\\1 $gitbin = \"'$GIT_EXEC_PATH'\";#;\n+s#\\(my\\|our\\) $projects_list =.*#\\1 $projects_list = $projectroot;#;\n+s#\\(my\\|our\\) $git_temp =.*#\\1 $git_temp = \"'$fqgitdir/gitweb/tmp'\";#'\n+\n+gitweb_cgi () {\n+\tcat > \"$1.tmp\" <<\\EOFGITWEB\n+@@GITWEB_CGI@@\n+EOFGITWEB\n+\tsed \"$script\" \"$1.tmp\"  > \"$1\"\n+\tchmod +x \"$1\"\n+\trm -f \"$1.tmp\"\n+}\n+\n+gitweb_css () {\n+\tcat > \"$1\" <<\\EOFGITWEB\n+@@GITWEB_CSS@@\n+EOFGITWEB\n+}\n+\n+gitweb_cgi $GIT_DIR/gitweb/gitweb.cgi\n+gitweb_css $GIT_DIR/gitweb/gitweb.css\n+\n+case \"$httpd\" in\n+*lighttpd*)\n+\tlighttpd_conf\n+\t;;\n+*apache2*)\n+\tapache2_conf\n+\t;;\n+*)\n+\techo \"Unknown httpd specified: $httpd\"\n+\texit 1\n+\t;;\n+esac\n+\n+start_httpd\n+test -z \"$browser\" && browser=echo\n+$browser http://127.0.0.1:$port\n-- \n1.4.1.rc2.gbf43\n"},{"id":"22999","messageId":"4fb292fa0607011551h6261e393nba79c7a0e65d9f60@mail.gmail.com","threadId":"4676","inReplyTo":"7vwtayh56z.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH/RFC] Add git-instaweb, instantly browse the working repo with gitweb","fromName":"Bertrand Jacquin","fromEmail":"beber.mailing@gmail.com","sentAt":"2006-07-01T22:51:30Z","receivedAt":"2006-07-01T22:51:30Z","isPatch":true,"sender":{"key":"beber.mailing@gmail.com","avatar":null},"body":"On 6/30/06, Junio C Hamano <junkio@cox.net> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n>\n> > I got tired of having to configure gitweb for every repository\n> > I work on.  I sometimes prefer gitweb to standard GUIs like gitk\n> > or gitview; so this lets me automatically configure gitweb to\n> > browse my working repository and also opens my browser to it.\n> >\n> > Signed-off-by: Eric Wong <normalperson@yhbt.net>\n>\n> This is cute but I haven't seen much responses to it yet.  Are\n> people uninterested?\n\nI am.\n\n-- \n# Beber : beber@gna.org\n# IM : beber@jabber.fr\n# http://guybrush.ath.cx, irc://irc.freenode.net/#{e.fr,gentoofr}\n"}]}