Skip to content

Commit c569969

Browse files
hashplinggitster
authored andcommitted
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>
1 parent ecaa0cf commit c569969

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
880880
-e '/@@GITWEB_CGI@@/d' \
881881
-e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
882882
-e '/@@GITWEB_CSS@@/d' \
883+
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
883884
$@.sh > $@+ && \
884885
chmod +x $@+ && \
885886
mv $@+ $@

git-instaweb.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Copyright (c) 2006 Eric Wong
44
#
55

6+
PERL='@@PERL@@'
67
OPTIONS_KEEPDASHDASH=
78
OPTIONS_SPEC="\
89
git-instaweb [options] (--start | --stop | --restart)
@@ -232,16 +233,18 @@ EOF
232233
}
233234

234235
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'";#;'
239240

240241
gitweb_cgi () {
241242
cat > "$1.tmp" <<\EOFGITWEB
242243
@@GITWEB_CGI@@
243244
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"
245248
chmod +x "$1"
246249
rm -f "$1.tmp"
247250
}
@@ -273,4 +276,4 @@ esac
273276

274277
start_httpd
275278
url=http://127.0.0.1:$port
276-
"$browser" $url || echo $url
279+
test -n "$browser" && "$browser" $url || echo $url

0 commit comments

Comments
 (0)