Git instaweb using mongoose and msysGit
Monday, 12 October 2009 by alexandrulRequirements
- Git up and running (tested with 1.7.0.1, 1.6.6.2, 1.6.5.8, and 1.6.4.4)
- mongoose, current version is mongoose-2.8.exe
- CGI.pm, current version is CGI.pm-3.48.tar.gz
- perllib
- perllib (alternate location)
Mongoose setup
Rename mongoose-2.8.exe to mongoose4instagit.exe and place it in any folder at your choice, in my case: k:\dev\tools\mongoose\mongoose4instagit.exe
Gitweb setup
In a msysGit shell run the following commands to build gitweb.cgi in case it’s not already present (like after running make clean in /git folder):
cd /git make gitweb/gitweb.cgi
Next, extract CGI.pm archive content, and copy the content of the lib subfolder to /lib/perl5/site_perl, keeping the folder structure:
CGI.pm CGI/Apache.pm CGI/Carp.pm CGI/Cookie.pm CGI/Fast.pm CGI/Pretty.pm CGI/Push.pm CGI/Switch.pm CGI/Util.pm
In case of UTF8-related errors, go to perllib ftp and download the following files to the same folder /lib/perl5/site_perl, keeping the folder structure:
Config_heavy.pl utf8_heavy.pl unicore/Canonical.pl unicore/Exact.pl unicore/PVA.pl
The final step is to extract the git-mongoose.zip content (a single file named git-mongoose) to the /libexec/git-core folder.
Customizing file locations
Inside the git-mongoose script you must adjust the file locations accordingly to your setup, my settings are listed below:
#
# config
mongoose_name="mongoose4instagit" # mongoose executable name only
mongoose_folder="/k/dev/tools/mongoose" # mongoose folder without trailing slash, linux style
mongoose_folder_win="k:\dev\tools\mongoose" # mongoose folder without trailing slash, windows style
mongoose_port="$(git config --get mongoose.port)"
test -z "${mongoose_port}" && mongoose_port=12345 # mongoose default port
git_path="/k/dev/tools/msysGit/bin/git.exe" # git executable full path, linux style
perl_path_win="k:\dev\tools\msysGit\bin\perl.exe" # perl executable full path, windows style
cgi_path_win="k:\dev\tools\msysGit\bin" # msysgit bin folder full path, windows style
Notes
The script must be run from a msysGit shell, not from cmd.exe. Also, it must be run from the root of the repository. The command used to launch it is:
git mongoose
mongoose could be launched directly from the script, but since it doesn’t detach from terminal, closing the shell would kill mongoose. As a result, a cmd.exe instance is used to launch mongoose. A side-effect is that git mongoose stop command has no effect, and mongoose must be stopped by closing the cmd.exe window.