Skip to content

Commit

Permalink
instaweb: use 'git-web--browse' to launch browser.
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Feb 5, 2008
1 parent 5884f1f commit 2e0c290
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions git-instaweb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ restart restart the web server
fqgitdir="$GIT_DIR"
local="`git config --bool --get instaweb.local`"
httpd="`git config --get instaweb.httpd`"
browser="`git config --get instaweb.browser`"
test -z "$browser" && browser="`git config --get web.browser`"
port=`git config --get instaweb.port`
module_path="`git config --get instaweb.modulepath`"

Expand All @@ -36,9 +34,6 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f'

# probably the most popular browser among gitweb users
test -z "$browser" && browser='firefox'

# any untaken local port will do...
test -z "$port" && port=1234

Expand Down Expand Up @@ -274,14 +269,11 @@ webrick)
;;
esac

init_browser_path() {
browser_path="`git config browser.$1.path`"
test -z "$browser_path" && browser_path="$1"
}

start_httpd
url=http://127.0.0.1:$port
test -n "$browser" && {
init_browser_path "$browser"
"$browser_path" $url
} || echo $url

if test -n "$browser"; then
git web--browse -b "$browser" $url || echo $url
else
git web--browse -c "instaweb.browser" $url || echo $url
fi

0 comments on commit 2e0c290

Please sign in to comment.