git-instaweb: Move all actions at the end of script
[gitweb.git] / git-instaweb.sh
index 2be22a0dfe943918d91a4a557fde0f27790a815f..9a2f20f6adafb2e31d306155bd75c960de9fe512 100755 (executable)
@@ -27,6 +27,7 @@ httpd="$(git config --get instaweb.httpd)"
 root="$(git config --get instaweb.gitwebdir)"
 port=$(git config --get instaweb.port)
 module_path="$(git config --get instaweb.modulepath)"
+action="browse"
 
 conf="$GIT_DIR/gitweb/httpd.conf"
 
@@ -148,17 +149,13 @@ while test $# != 0
 do
        case "$1" in
        --stop|stop)
-               stop_httpd
-               exit 0
+               action="stop"
                ;;
        --start|start)
-               start_httpd
-               exit 0
+               action="start"
                ;;
        --restart|restart)
-               stop_httpd
-               start_httpd
-               exit 0
+               action="restart"
                ;;
        -l|--local)
                local=true
@@ -611,6 +608,22 @@ configure_httpd() {
        esac
 }
 
+case "$action" in
+stop)
+       stop_httpd
+       exit 0
+       ;;
+start)
+       start_httpd
+       exit 0
+       ;;
+restart)
+       stop_httpd
+       start_httpd
+       exit 0
+       ;;
+esac
+
 gitweb_conf
 
 resolve_full_httpd