instaweb: Minor cleanups and fixes for potential problems
Fix path quoting and test of empty values that some shells do not like. Remove duplicate check and setting of $browser. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonas Fonseca committed
Nov 9, 2007 at 00:21 UTC
9126425df1fefa6b2843a45c8b087b8d87cb1955
1 file changed
+8
-9
git-instaweb.sh
+8
-9
@@ -15,7 +15,7 @@ browser="`git config --get instaweb.browser`"
15
port=`git config --get instaweb.port`
16
module_path="`git config --get instaweb.modulepath`"
17
18
-conf=$GIT_DIR/gitweb/httpd.conf
18
+conf="$GIT_DIR/gitweb/httpd.conf"
19
20
# Defaults:
21
@@ -32,7 +32,7 @@ start_httpd () {
32
httpd_only="`echo $httpd | cut -f1 -d' '`"
33
if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
34
then
35
- $httpd $fqgitdir/gitweb/httpd.conf
35
+ $httpd "$fqgitdir/gitweb/httpd.conf"
36
else
37
# many httpds are installed in /usr/sbin or /usr/local/sbin
38
# these days and those are not in most users $PATHs
@@ -146,14 +146,14 @@ server.pid-file = "$fqgitdir/pid"
146
cgi.assign = ( ".cgi" => "" )
147
mimetype.assign = ( ".css" => "text/css" )
148
EOF
149
- test "$local" = true && echo 'server.bind = "127.0.0.1"' >> "$conf"
149
+ test x"$local" = xtrue && echo 'server.bind = "127.0.0.1"' >> "$conf"
150
}
151
152
apache2_conf () {
153
test -z "$module_path" && module_path=/usr/lib/apache2/modules
154
mkdir -p "$GIT_DIR/gitweb/logs"
155
bind=
156
- test "$local" = true && bind='127.0.0.1:'
156
+ test x"$local" = xtrue && bind='127.0.0.1:'
157
echo 'text/css css' > $fqgitdir/mime.types
158
cat > "$conf" <<EOF
159
ServerName "git-instaweb"
@@ -206,7 +206,7 @@ EOF
206
}
207
208
script='
209
-s#^\(my\|our\) $projectroot =.*#\1 $projectroot = "'`dirname $fqgitdir`'";#
209
+s#^\(my\|our\) $projectroot =.*#\1 $projectroot = "'$(dirname "$fqgitdir")'";#
210
s#\(my\|our\) $gitbin =.*#\1 $gitbin = "'$GIT_EXEC_PATH'";#
211
s#\(my\|our\) $projects_list =.*#\1 $projects_list = $projectroot;#
212
s#\(my\|our\) $git_temp =.*#\1 $git_temp = "'$fqgitdir/gitweb/tmp'";#'
@@ -226,8 +226,8 @@ gitweb_css () {
226
EOFGITWEB
227
}
228
229
-gitweb_cgi $GIT_DIR/gitweb/gitweb.cgi
230
-gitweb_css $GIT_DIR/gitweb/gitweb.css
229
+gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi"
230
+gitweb_css "$GIT_DIR/gitweb/gitweb.css"
231
232
case "$httpd" in
233
*lighttpd*)
@@ -243,6 +243,5 @@ case "$httpd" in
243
esac
244
245
start_httpd
246
-test -z "$browser" && browser=echo
246
url=http://127.0.0.1:$port
248
-$browser $url || echo $url
247
+"$browser" $url || echo $url