git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Cc: Gurjeet Singh <singh.gurjeet@gmail.com>,
	Eric Wong <normalperson@yhbt.net>
Subject: [PATCH 3/4] git-instaweb: Move all actions at the end of script
Date: Thu, 23 Jun 2011 22:59:26 +0200	[thread overview]
Message-ID: <20110623195652.18265.50516.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110623194624.18265.82482.stgit@localhost.localdomain>

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>
---
Unfortunately there are no tests for git-instaweb, so I couldn't test
if it is really no much of a functional change.

BTW. if you thought of a better subject for this commit, please speak
up.

 git-instaweb.sh |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index 2be22a0..9a2f20f 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -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

  parent reply	other threads:[~2011-06-23 21:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-23  1:06 Having some problem with instaweb Gurjeet Singh
2011-06-23  8:23 ` Jakub Narebski
2011-06-23 11:48   ` Gurjeet Singh
2011-06-23 19:29     ` Jakub Narebski
2011-06-23 19:50       ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Jakub Narebski
2011-06-23 19:55         ` [PATCH 1/4] git-instaweb: Extract configuring web server into configure_httpd Jakub Narebski
2011-06-23 19:56         ` [PATCH 2/4] git-instaweb: Use $conf, not $fqgitdir/gitweb/httpd.conf Jakub Narebski
2011-06-23 20:59         ` Jakub Narebski [this message]
2011-06-23 21:01         ` [PATCH 4/4] git-instaweb: Check that correct config file exists for (re)start Jakub Narebski
2011-06-28  3:22         ` [PATCH 0/4] git-instaweb: Improving handling of --start/--restart Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110623195652.18265.50516.stgit@localhost.localdomain \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    --cc=singh.gurjeet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).