Fix git-instaweb breakage on MacOS X due to the limited sed functionality
git-instaweb relied on a pipe in a sed script, but this is not supported by MacOS X sed when using BREs. git-instaweb relies on a working perl in any case, and perl re are more consistent between platforms, so replace sed invocation with an equivalent perl invocation. Also, fix the documented -b "" to work without giving a spurious 'command not found' error. Signed-off-by: Charles Bailey <charles@hashpling.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charles Bailey committed
Dec 19, 2007 at 12:25 UTC
c5699693638d0471bf74425238d802d2bc9e8c0f
2 files changed
+10
-6
Makefile
+1
@@ -880,6 +880,7 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
880
-e '/@@GITWEB_CGI@@/d' \
881
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
882
-e '/@@GITWEB_CSS@@/d' \
883
+ -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
884
$@.sh > $@+ && \
885
chmod +x $@+ && \
886
mv $@+ $@
git-instaweb.sh
+9
-6
@@ -3,6 +3,7 @@
3
# Copyright (c) 2006 Eric Wong
4
#
5
6
+PERL='@@PERL@@'
7
OPTIONS_KEEPDASHDASH=
8
OPTIONS_SPEC="\
9
git-instaweb [options] (--start | --stop | --restart)
@@ -232,16 +233,18 @@ EOF
233
}
234
235
script='
235
-s#^\(my\|our\) $projectroot =.*#\1 $projectroot = "'$(dirname "$fqgitdir")'";#
236
-s#\(my\|our\) $gitbin =.*#\1 $gitbin = "'$GIT_EXEC_PATH'";#
237
-s#\(my\|our\) $projects_list =.*#\1 $projects_list = $projectroot;#
238
-s#\(my\|our\) $git_temp =.*#\1 $git_temp = "'$fqgitdir/gitweb/tmp'";#'
236
+s#^(my|our) \$projectroot =.*#$1 \$projectroot = "'$(dirname "$fqgitdir")'";#;
237
+s#(my|our) \$gitbin =.*#$1 \$gitbin = "'$GIT_EXEC_PATH'";#;
238
+s#(my|our) \$projects_list =.*#$1 \$projects_list = \$projectroot;#;
239
+s#(my|our) \$git_temp =.*#$1 \$git_temp = "'$fqgitdir/gitweb/tmp'";#;'
240
241
gitweb_cgi () {
242
cat > "$1.tmp" <<\EOFGITWEB
243
@@GITWEB_CGI@@
244
EOFGITWEB
244
- sed "$script" "$1.tmp" > "$1"
245
+ # Use the configured full path to perl to match the generated
246
+ # scripts' 'hashpling' line
247
+ "$PERL" -p -e "$script" "$1.tmp" > "$1"
248
chmod +x "$1"
249
rm -f "$1.tmp"
250
}
@@ -273,4 +276,4 @@ esac
276
277
start_httpd
278
url=http://127.0.0.1:$port
276
-"$browser" $url || echo $url
279
+test -n "$browser" && "$browser" $url || echo $url