git-instaweb: Move all actions at the end of script

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 <jnareb@gmail.com>
Acked-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
Jakub Narebski
2011-06-23 22:59:26 +02:00
committed by Eric Wong
parent 48bf76ca93
commit c0175f92c7

View File

@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)"
root="$(git config --get instaweb.gitwebdir)" root="$(git config --get instaweb.gitwebdir)"
port=$(git config --get instaweb.port) port=$(git config --get instaweb.port)
module_path="$(git config --get instaweb.modulepath)" module_path="$(git config --get instaweb.modulepath)"
action="browse"
conf="$GIT_DIR/gitweb/httpd.conf" conf="$GIT_DIR/gitweb/httpd.conf"
@ -148,17 +149,13 @@ while test $# != 0
do do
case "$1" in case "$1" in
--stop|stop) --stop|stop)
stop_httpd action="stop"
exit 0
;; ;;
--start|start) --start|start)
start_httpd action="start"
exit 0
;; ;;
--restart|restart) --restart|restart)
stop_httpd action="restart"
start_httpd
exit 0
;; ;;
-l|--local) -l|--local)
local=true local=true
@ -611,6 +608,22 @@ configure_httpd() {
esac esac
} }
case "$action" in
stop)
stop_httpd
exit 0
;;
start)
start_httpd
exit 0
;;
restart)
stop_httpd
start_httpd
exit 0
;;
esac
gitweb_conf gitweb_conf
resolve_full_httpd resolve_full_httpd