path: root/
AgeCommit message (Collapse)Author
2011-06-27git-instaweb: Check that correct config file exists for (re)startJakub Narebski
Currently start/restart does not generate any configuration files for spawning a new instance. This means that $ git instaweb --http=<server> --start might pick up stale 'httpd.conf' file for a different web server (e.g. for default lighttpd when requesting apache2). This commit changes that, and makes git-instaweb generate web server config file and/or gitweb config file if don't exists. This required naming config files after the name of web server (alternate solution would be to somehow mark for which web server was config file generated). Note that web servers that embed configuration in server script file, namely webrick and plackup, and which delete "$conf" in their *_conf function, would have their config (server script) always regenerated. Note: this commit introduces a bit of code repetition (but only a few lines). Reported-by: Gurjeet Singh <> Signed-off-by: Jakub Narebski <> Acked-by: Eric Wong <>
2011-06-27git-instaweb: Move all actions at the end of scriptJakub Narebski
As a nice side-effect now the order of parameters does not matter: $ git instaweb --httpd=apache2 --start is now (after this patch) the same as $ git instaweb --start --httpd=apache2 Before this commit --start, --stop, --restart (and their subcommand versions start, stop, restart) exited immediately. This is preparatory work for making start/restart check that correct configuration is set up; this change was required to have access in start_httpd to requested web browser etc. Signed-off-by: Jakub Narebski <> Acked-by: Eric Wong <>
2011-06-27git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.confJakub Narebski
Don't repeat yourself: use "$conf" instead of its [current] contents, namely "$fqgitdir/gitweb/httpd.conf". Signed-off-by: Jakub Narebski <> Acked-by: Eric Wong <>
2011-06-27git-instaweb: Extract configuring web server into configure_httpdJakub Narebski
This is preparatory work for making start/restart check that git-instaweb set up correct configuration, and generate it if it is missing. Pure refactoring, no functional changes. Signed-off-by: Jakub Narebski <> Acked-by: Eric Wong <>
2011-02-28git-instaweb: Change how gitweb.psgi is made runnable as standalone appJakub Narebski
According to blog post "FindBin, __FILE__, $0 and PSGI woes" by Tatsuhiko Miyagawa, using 'if (__FILE__ eq $0)' in .psgi code (to check if script was run from command line), is not supposed to work since Plack 0.9971. Replace it with one of proposed solutions; while at it return $app explicitely, rather than implicitely by being a last expression. This affects 'plackup' web server. While at it cleanup whitespace. Signed-off-by: Jakub Narebski <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2010-11-17git instaweb: enable remote_headsGiuseppe Bilotta
When using git instaweb to browse a local repository, performance is much less of an issue, and providing as much information as possible has a higher priority, so it makes sense to enable remote_heads. Signed-off-by: Giuseppe Bilotta <> Acked-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2010-08-05instaweb: add access+error logging for WEBrickEric Wong
This allows WEBrick to support all the logging functionality in a manner consistent with the other web servers. Signed-off-by: Eric Wong <>
2010-08-05instaweb: minimize moving parts for WEBrickEric Wong
Since there are WEBrick configuration settings (including the upcoming AccessLog support) that cannot be represented in YAML and require Ruby anyways, the YAML config file is an unnecessary layer of complexity. Additionally, the shell script wrapper to start WEBrick is unecessary since our generated Ruby script can be made executable in the same manner with /usr/bin/env. Signed-off-by: Eric Wong <>
2010-08-05instaweb: fix WEBrick server supportEric Wong
This has been broken since commit be5347b ("httpd logs in a "$httpd_only" subdirectory"). Since WEBrick has no other way of preserving environment variables needed for gitweb, we create a shell script wrapper that sets the environment variables as our CGI interpreter to run gitweb.cgi. Signed-off-by: Eric Wong <>
2010-07-23git-instaweb: Don't assume Apache executable is named apache2Dan McGee
On Arch Linux, the executable for the Apache HTTP server keeps the 'httpd' name and is not named 'apache2'. The path to the server modules also contains 'httpd' rather than 'apache2'. Remove some of these assumptions and add the httpd name in where it may be required. Finally, make some slight style adjustments to the code we are touching to make it fit the style of the rest of the script. Signed-off-by: Dan McGee <> Acked-by: Eric Wong <>
2010-07-23git-instaweb: Fix Apache environment variable passingDan McGee
We were passing the non-existent GIT_EXEC_DIR through instead of the real GIT_EXEC_PATH. In addition, these weren't being passed at all for CGI (non mod_perl) execution so get them included there as well. Signed-off-by: Dan McGee <> Acked-by: Eric Wong <>
2010-07-23git-instaweb: Fix custom apache log placementDan McGee
'CustomLog' is provided by mod_log_config so we need to include the module in our generated config. This was added in d94775e1f9a. Signed-off-by: Dan McGee <> Acked-by: Eric Wong <>
2010-06-02git-instaweb: Add support for running gitweb via 'plackup'Jakub Narebski
PSGI is an interface between Perl web applications and web servers, and Plack is a Perl module and toolkit that contains PSGI middleware, helpers and adapters to web servers; see PSGI and Plack are inspired by Python's WSGI and Ruby's Rack (and probably JavaScript's Jack/JSGI). Plack core distribution includes HTTP::Server::PSGI, a reference PSGI standalone web server implementation. 'plackup' is a command line launcher to run PSGI applications from command line, connecting web app to a web server via Plack::Runner module. By default it uses HTTP::Server::PSGI as a web server. git-instaweb generates gitweb.psgi wrapper (in $GIT_DIR/gitweb). This wrapper uses Plack::App::WrapCGI to compile gitweb.cgi (which is a CGI script) into a PSGI application using CGI::Compile and CGI::Emulate::PSGI. git-instaweb then runs this wrapper, using by default HTTP::Server::PSGI standalone Perl server, via Plack::Runner. The configuration for 'plackup' is currently embedded in generated gitweb.psgi wrapper, instead of using httpd.conf ($conf). To run git-instaweb with '--httpd=plackup', you need to have instaled Plack core, CGI::Emulate::PSGI, CGI::Compile. Those modules have to be available for Perl scripts (which can be done for example by setting PERL5LIB environment variable). This is currently not documented. Signed-off-by: Jakub Narebski <> Acked-by: Petr Baudis <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2010-06-02git-instaweb: Wait for server to start before running web browserJakub Narebski
Add generic httpd_is_ready subroutine, which busy-waits for web server to be started, by checking if $port is opened on localhost. This is used to avoid situation where web browser is started before web server is ready to accept connection, and fails. It uses IO::Socket::INET module, which is core Perl module since v5.6.0. Alternate solution, possible for those web servers that can run arbitrary code hooks after they bind the listen socket (after they start accepting connections), would be to use some kind of blocking mechanism: FIFO or lockfile, see This can be always added later, as a web server specific branch in httpd_is_ready function. Signed-off-by: Jakub Narebski <> Acked-by: Petr Baudis <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2010-06-02git-instaweb: Remove pidfile after stopping web serverJakub Narebski
This way running e.g. "git instaweb" after "git instaweb --stop" would not try to kill already stopped web server. This is probably important only for those web servers that are "daemonized" by git-instaweb itself, i.e. for those where it is git-instaweb that creates pidfile. Currently it is includes only 'mongoose' web server, but it would also include 'plackup' web server (added in later commit). Signed-off-by: Jakub Narebski <> Acked-by: Petr Baudis <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2010-06-01git-instaweb: Configure it to work with new gitweb structurePavan Kumar Sunkara
git-instaweb in its current form (re)creates gitweb.cgi and (some of) required static files in $GIT_DIR/gitweb/ directory. Splitting gitweb would make it difficult for git-instaweb to continue with this method. Use the instaweb.gitwebdir config variable to point git-instaweb script to a global directory which contains gitweb files as server root and the httpd.conf along with server logs and pid go into '$(GIT_DIR)/gitweb' directory. Signed-off-by: Pavan Kumar Sunkara <> Mentored-by: Christian Couder <> Mentored-by: Petr Baudis <> Acked-by: Jakub Narebski <> Acked-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2010-06-01git-instaweb: Put httpd logs in a "$httpd_only" subdirectoryPavan Kumar Sunkara
Resolve full httpd and create "$httpd_only" subdirectory before writing httpd.conf so that error.log and access.log go into it. While at it, change apache2 configuration to use logs in a similiar fashion. Signed-off-by: Pavan Kumar Sunkara <> Mentored-by: Christian Couder <> Mentored-by: Petr Baudis <> Acked-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2010-04-17git-instaweb: pass through invoking user's path to gitweb CGI scriptsChris Webb
When used with lighttpd or mongoose, git-instaweb previously passed a hard-coded, default value of PATH to the gitweb CGI script. Use the invoking user's value for PATH for this instead. (This is already implicitly the behaviour for other web servers supported by git-instaweb.) Signed-off-by: Chris Webb <> Acked-by: Eric Wong <>
2010-04-03instaweb: add minification awarenessMark Rada
This patch will cause git-instaweb to use the minified version of gitweb support files (e.g. CSS and JavaScript) if they were generated. Without minification awareness, generating the minified version of gitweb's support files will generate a broken instaweb script since the copy of gitweb.cgi will look for gitweb.min.* which will not exist. Signed-off-by: Mark Rada <> Signed-off-by: Junio C Hamano <>
2010-01-26fix portability issues with $ in double quotesStephen Boyd
Using a dollar sign in double quotes isn't portable. Escape them with a backslash or replace the double quotes with single quotes. Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
2009-12-01Merge branch 'jn/gitweb-blame'Junio C Hamano
* jn/gitweb-blame: gitweb: Add link to other blame implementation in blame views gitweb: Make linking to actions requiring JavaScript a feature gitweb.js: fix padLeftStr() and its usage gitweb.js: Harden setting blamed commit info in incremental blame gitweb.js: fix null object exception in initials calculation gitweb: Minify gitweb.js if JSMIN is defined gitweb: Create links leading to 'blame_incremental' using JavaScript gitweb: Colorize 'blame_incremental' view during processing gitweb: Incremental blame (using JavaScript) gitweb: Add optional "time to generate page" info in footer Conflicts: Makefile gitweb/gitweb.css
2009-11-25Merge branch 'rs/work-around-grep-opt-insanity'Junio C Hamano
* rs/work-around-grep-opt-insanity: Protect scripted Porcelains from GREP_OPTIONS insanity mergetool--lib: simplify guess_merge_tool() Conflicts:
2009-11-24Merge branch 'maint'Junio C Hamano
* maint: pack-objects: split implications of --all-progress from progress activation instaweb: restart server if already running prune-packed: only show progress when stderr is a tty Conflicts: builtin-pack-objects.c
2009-11-24instaweb: restart server if already runningStephen Boyd
Running 'git instaweb' when an instaweb server is already running will fail (at least when the port is the same) and overwrite the pid file used to track the currently running server. This turns out to be especially annoying when the user tries to stop the previously running server with 'git instaweb --stop' and is instead greeted with an error message because the pid file has been destroyed. Instead of allowing a user to start two instaweb servers, stop the currently running server first and then start the new one. This should be fine because it was never really possible to start two instaweb servers in the first place due to the pid file issue outlined above. Signed-off-by: Stephen Boyd <> Signed-off-by: Junio C Hamano <>
2009-11-24Protect scripted Porcelains from GREP_OPTIONS insanityJunio C Hamano
If the user has exported the GREP_OPTIONS environment variable, the output from "grep" and "egrep" in scripted Porcelains may be different from what they expect. For example, we may want to count number of matching lines, by "grep" piped to "wc -l", and GREP_OPTIONS=-C3 will break such use. The approach taken by this change to address this issue is to protect only our own use of grep/egrep. Because we do not unset it at the beginning of our scripts, hook scripts run from the scripted Porcelains are exposed to the same insanity this environment variable causes when grep/egrep is used to implement logic (e.g. "grep | wc -l"), and it is entirely up to the hook scripts to protect themselves. On the other hand, applypatch-msg hook may want to show offending words in the proposed commit log message using grep to the end user, and the user might want to set GREP_OPTIONS=--color to paint the match more visibly. The approach to protect only our own use without unsetting the environment variable globally will allow this use case. Signed-off-by: Junio C Hamano <>
2009-09-29instaweb: support mod_cgid for apache2Mark Rada
Some people have mod_cgid instead of mod_cgi, most likely as a result of choosing a threaded MPM. In cases where the user has both modules, mod_cgi will be preferred in order to maintain a simpler setup. This patch also causes instaweb to print a message and die in cases where there is no module that instaweb knows how to handle. Signed-off-by: Mark Rada <> Signed-off-by: Shawn O. Pearce <>
2009-09-01gitweb: Incremental blame (using JavaScript)Jakub Narebski
Add 'blame_incremental' view, which uses "git blame --incremental" and JavaScript (Ajax), where 'blame' use "git blame --porcelain". * gitweb generates initial info by putting file contents (from "git cat-file") together with line numbers in blame table * then gitweb makes web browser JavaScript engine call startBlame() function from gitweb.js * startBlame() opens XMLHttpRequest connection to 'blame_data' view, which in turn calls "git blame --incremental" for a file, and streams output of git-blame to JavaScript (gitweb.js) * XMLHttpRequest event handler updates line info in blame view as soon as it gets data from 'blame_data' (from server), and it also updates progress info * when 'blame_data' ends, and gitweb.js finishes updating line info, it fixes colors to match (as far as possible) ordinary 'blame' view, and updates information about how long it took to generate page. Gitweb deals with streamed 'blame_data' server errors by displaying them in the progress info area (just in case). The 'blame_incremental' view tries to be equivalent to 'blame' action; there are however a few differences in output between 'blame' and 'blame_incremental' view: * 'blame_incremental' always used query form for this part of link(s) which is generated by JavaScript code. The difference is visible if we use path_info link (pass some or all arguments in path_info). Changing this would require implementing something akin to href() subroutine from gitweb.perl in JavaScript (in gitweb.js). * 'blame_incremental' always uses "rowspan" attribute, even if rowspan="1". This simplifies code, and is not visible to user. * The progress bar and progress info are still there even after JavaScript part of 'blame_incremental' finishes work. Note that currently no link generated by gitweb leads to this new view. This code is based on patch by Petr Baudis <> patch, which in turn was tweaked up version of Fredrik Kuivinen <>'s proof of concept patch. This patch adds GITWEB_JS compile configuration option, and modifies to take gitweb.js into account. The code for was taken from Pasky's patch. Signed-off-by: Fredrik Kuivinen <> Signed-off-by: Petr Baudis <> Signed-off-by: Jakub Narebski <> Signed-off-by: Junio C Hamano <>
2009-08-23Add support for the Mongoose web server.Wilhansen Li
Mongoose ( is a lightweight web server. It's just a single binary so it's a lot simpler to configure and install. Signed-off-by: Wilhansen Li <> Signed-off-by: Junio C Hamano <>
2009-08-10git-instaweb: fix mod_perl detection for apache2Mark A Rada
The script was looking for something that matched the '^our $gitbin' regex, which no longer exists in gitweb.cgi. Now it looks for 'MOD_PERL', which should be on the line that checks to see if the script is running in a mod_perl environment. Signed-off-by: Mark Rada <> Signed-off-by: Junio C Hamano <>
2009-07-26Trivial path quoting fixes in git-instawebSean Estabrooks
Bodo Schlecht noticed that Instaweb didn't propely quote all path instances in the Apache config file it generated. Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2009-03-11git-instaweb: fix lighttpd configuration on cygwinRamsay Jones
Signed-off-by: Ramsay Jones <> Tested-by: Pascal Obry <> Signed-off-by: Junio C Hamano <>
2008-07-13Make usage strings dash-lessStephan Beyer
When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, generates a dash-less usage string now. Signed-off-by: Stephan Beyer <> Signed-off-by: Junio C Hamano <>
2008-06-14git-instaweb: improve auto-discovery of httpd and call conventions.Flavio Poletti
This patch allows calling: git-instaweb -d apache2 and have the script Do The Right Thing. In particular, the auto-discovery mechanism has been extended in order to be used for module listing as well, and the call convention is that if the daemon is apache2/lighttpd and the parameter to the "-d" option does not end by "-f", the "-f" is added to the end of the option itself. Change all backticks to $( ... ) as per Documentation/CodingGuidelines. Signed-off-by: Flavio Poletti <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2008-02-05instaweb: use 'git-web--browse' to launch browser.Christian Couder
Signed-off-by: Christian Couder <> Signed-off-by: Junio C Hamano <>
2008-01-29instaweb: use 'browser.<tool>.path' config option if it's set.Christian Couder
Signed-off-by: Christian Couder <> Acked-by: Eric Wong <> Signed-off-by: Junio C Hamano <>
2007-12-19Fix git-instaweb breakage on MacOS X due to the limited sed functionalityCharles Bailey
git-instaweb relied on a pipe in a sed script, but this is not supported by MacOS X sed when using BREs. git-instaweb relies on a working perl in any case, and perl re are more consistent between platforms, so replace sed invocation with an equivalent perl invocation. Also, fix the documented -b "" to work without giving a spurious 'command not found' error. Signed-off-by: Charles Bailey <> Signed-off-by: Junio C Hamano <>
2007-12-09Use {web,instaweb,help}.browser config options.Christian Couder
Now "git-instaweb" will try to use the browser configured as "web.browser", if "instaweb.browser" is not set. "git-browse-help" will check first "help.browser" and then "web.browser". Signed-off-by: Christian Couder <> Signed-off-by: Junio C Hamano <>
2007-11-18Merge branch 'ph/parseopt-sh'Junio C Hamano
* ph/parseopt-sh: fix --patches handling git-am: -i does not take a string parameter. sh-setup: don't let eval output to be shell-expanded. git-sh-setup: fix parseopt `eval` string underquoting Give git-am back the ability to add Signed-off-by lines. git-rev-parse --parseopt scripts: Add placeholders for OPTIONS_SPEC Migrate to use git-rev-parse --parseopt Migrate to use git-rev-parse --parseopt Migrate to use git-rev-parse --parseopt --keep-dashdash Migrate to use git-rev-parse --parseopt Migrate to use git-rev-parse --parseopt Migrate to use git-rev-parse --parseopt Migrate git-clone to use git-rev-parse --parseopt Migrate to use git-rev-parse --parseopt. Update git-sh-setup(1) to allow transparent use of git-rev-parse --parseopt Add a parseopt mode to git-rev-parse to bring parse-options to shell scripts.
2007-11-09Merge branch 'maint'Junio C Hamano
* maint: Start preparing for git-send-email: Change the prompt for the subject of the initial message. SubmittingPatches: improve the 'Patch:' section of the checklist instaweb: Minor cleanups and fixes for potential problems stop t1400 hiding errors in tests Makefile: add missing dependency on wt-status.h refresh_index_quietly(): express "optional" nature of index writing better Fix sed string regex escaping in module_name. Avoid a few unportable, needlessly nested "...`...". git-mailsplit: with maildirs not only process cur/, but also new/ Signed-off-by: Junio C Hamano <>
2007-11-09instaweb: Minor cleanups and fixes for potential problemsJonas Fonseca
Fix path quoting and test of empty values that some shells do not like. Remove duplicate check and setting of $browser. Signed-off-by: Jonas Fonseca <> Signed-off-by: Junio C Hamano <>
2007-11-06Migrate to use git-rev-parse --parseoptPierre Habouzit
Signed-off-by: Pierre Habouzit <> Signed-off-by: Junio C Hamano <>
2007-10-17Merge branch 'maint'Shawn O. Pearce
* maint: Document additional fixes in release notes Avoid 'expr index' on Mac OS X as it isn't supported filter-branch: update current branch when rewritten fix filter-branch documentation helpful error message when send-pack finds no refs in common. Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE Correct typos in release notes for
2007-10-17Avoid 'expr index' on Mac OS X as it isn't supportedShawn O. Pearce
This fixes git-instaweb so it can start an httpd without warning about an invalid test command. Yes its ugly, but its also quite portable. Signed-off-by: Shawn O. Pearce <>
2007-10-16instaweb: support for Ruby's WEBrick serverMike Dalessio
running the webrick server with git requires Ruby and Ruby's YAML and Webrick libraries (both of which come standard with Ruby). nice for single-user standalone invocations. the --httpd=webrick option generates a ruby script on the fly to read httpd.conf options and invoke the web server via library call. this script is placed in the .git/gitweb directory. it also generates a shell script in a feeble attempt to invoke ruby in a portable manner, which assumes that 'ruby' is in the user's $PATH. Signed-off-by: Mike Dalessio <> Signed-off-by: Lars Hjemli <> Signed-off-by: Shawn O. Pearce <>
2007-10-16instaweb: allow for use of auto-generated scriptsMike Dalessio
this patch allows scripts that reside in $fqgitdir/gitweb to be used for firing up an instaweb server. this lays the groundwork for extending instaweb support to non-standard web servers, which may require a script for proper invocation. Signed-off-by: Mike Dalessio <> Signed-off-by: Lars Hjemli <> Signed-off-by: Shawn O. Pearce <>
2007-09-23Supplant the "while case ... break ;; esac" idiomDavid Kastrup
A lot of shell scripts contained stuff starting with while case "$#" in 0) break ;; esac and similar. I consider breaking out of the condition instead of the body od the loop ugly, and the implied "true" value of the non-matching case is not really obvious to humans at first glance. It happens not to be obvious to some BSD shells, either, but that's because they are not POSIX-compliant. In most cases, this has been replaced by a straight condition using "test". "case" has the advantage of being faster than "test" on vintage shells where "test" is not a builtin. Since none of them is likely to run the git scripts, anyway, the added readability should be worth the change. A few loops have had their termination condition expressed differently. Signed-off-by: David Kastrup <> Signed-off-by: Junio C Hamano <> make GIT_DIR absoluteDavid Kastrup
Quite a few of the scripts are rather careless about using GIT_DIR while changing directories. Some try their hands (with different likelihood of success) in making GIT_DIR absolute. This patch lets cater for absolute directories (in a way that should work reliably also with non-Unix path names) and removes the respective kludges in and Signed-off-by: David Kastrup <> Signed-off-by: Junio C Hamano <>
2007-01-29[PATCH] Rename git-repo-config to git-config.Tom Prince
Signed-off-by: Tom Prince <> Signed-off-by: Junio C Hamano <>
2007-01-06instaweb: Nicer error message when the http daemon isn't foundFredrik Kuivinen
Signed-off-by: Fredrik Kuivinen <> Signed-off-by: Junio C Hamano <>
2007-01-03instaweb: load Apache mime and dir modules if they are neededEric Wong
I've noticed that Apache 2.2 on a Debian etch machine has these compiled as modules. Also set ServerName to avoid a warning at startup. Signed-off-by: Eric Wong <> Signed-off-by: Junio C Hamano <>