git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix git-instaweb breakage on MacOS X due to the limited sed functionality

From
Charles Bailey <charles@hashpling.org>
Date
Dec 19, 2007, 10:57 UTC
Message-ID
<20071219105752.GA23932@hashpling.org>

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>
---
 git-instaweb.sh |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/git-instaweb.sh b/git-instaweb.sh
index 42d8d7f..3565734 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -232,16 +232,18 @@ EOF
 }
 
 script='
-s#^\(my\|our\) $projectroot =.*#\1 $projectroot = "'$(dirname "$fqgitdir")'";#
-s#\(my\|our\) $gitbin =.*#\1 $gitbin = "'$GIT_EXEC_PATH'";#
-s#\(my\|our\) $projects_list =.*#\1 $projects_list = $projectroot;#
-s#\(my\|our\) $git_temp =.*#\1 $git_temp = "'$fqgitdir/gitweb/tmp'";#'
+s#^(my|our) \$projectroot =.*#$1 \$projectroot = "'$(dirname "$fqgitdir")'";#;
+s#(my|our) \$gitbin =.*#$1 \$gitbin = "'$GIT_EXEC_PATH'";#;
+s#(my|our) \$projects_list =.*#$1 \$projects_list = \$projectroot;#;
+s#(my|our) \$git_temp =.*#$1 \$git_temp = "'$fqgitdir/gitweb/tmp'";#;'
 
 gitweb_cgi () {
 	cat > "$1.tmp" <<\EOFGITWEB
 @@GITWEB_CGI@@
 EOFGITWEB
-	sed "$script" "$1.tmp"  > "$1"
+	# The generated scripts assume that perl is /usr/bin/perl
+	# so the assumption here should be no more harmful
+	/usr/bin/perl -p -e "$script" "$1.tmp"  > "$1"
 	chmod +x "$1"
 	rm -f "$1.tmp"
 }
@@ -273,4 +275,4 @@ esac
 
 start_httpd
 url=http://127.0.0.1:$port
-"$browser" $url || echo $url
+test -n "$browser" && "$browser" $url || echo $url
-- 
1.5.4.rc0
Next: Wincent Colaiuta
Message 1 of 9 in “Fix git-instaweb breakage on MacOS X due to the limited sed functionality”
  1. Fix git-instaweb breakage on MacOS X due to the limited sed functionalityCharles Bailey, Dec 19, 2007
  2. Wincent ColaiutaDec 19, 2007
  3. Charles BaileyDec 19, 2007
  4. Wincent ColaiutaDec 19, 2007
  5. Charles BaileyDec 19, 2007
  6. Charles BaileyDec 19, 2007
  7. Charles BaileyDec 19, 2007
  8. Fix git-instaweb breakage on MacOS X due to the limited sed functionalityCharles Bailey, Dec 19, 2007
  9. Wincent ColaiutaDec 19, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.