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>

Jakub Narebski committed Jun 23, 2011 at 22:59 UTC c0175f92c7da1c379c25b5a70d53b9d550bcc11d
1 file changed +20 -7
git-instaweb.sh
+20 -7
@@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)"
27 root="$(git config --get instaweb.gitwebdir)"
28 port=$(git config --get instaweb.port)
29 module_path="$(git config --get instaweb.modulepath)"
30 +action="browse"
31
32 conf="$GIT_DIR/gitweb/httpd.conf"
33
@@ -148,17 +149,13 @@ while test $# != 0
149 do
150 case "$1" in
151 --stop|stop)
151 - stop_httpd
152 - exit 0
152 + action="stop"
153 ;;
154 --start|start)
155 - start_httpd
156 - exit 0
155 + action="start"
156 ;;
157 --restart|restart)
159 - stop_httpd
160 - start_httpd
161 - exit 0
158 + action="restart"
159 ;;
160 -l|--local)
161 local=true
@@ -611,6 +608,22 @@ configure_httpd() {
608 esac
609 }
610
611 +case "$action" in
612 +stop)
613 + stop_httpd
614 + exit 0
615 + ;;
616 +start)
617 + start_httpd
618 + exit 0
619 + ;;
620 +restart)
621 + stop_httpd
622 + start_httpd
623 + exit 0
624 + ;;
625 +esac
626 +
627 gitweb_conf
628
629 resolve_full_httpd