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

[PATCH 2/3] bisect: use "git rev-parse --sq-quote" instead of a custom "sq" function

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 24, 2009, 06:29 UTC
Message-ID
<20090424062902.3705.76155.chriscool@tuxfamily.org>

As the "sq" function was the only place using Perl in "git-bisect.sh", this removes the Perl dependency in this script.

While at it, we also remove the sed instruction in the Makefile that substituted @@PERL@@ with the Perl path in shell scripts, as this is not needed anymore. (It is now only needed in "git-instaweb.sh" but this command is dealt with separately in the Makefile.)

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 Makefile      |    1 -
 git-bisect.sh |   16 +++-------------
 2 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 5d491ad..bbe15d9 100644
--- a/Makefile
+++ b/Makefile
@@ -1247,7 +1247,6 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	$(QUIET_GEN)$(RM) $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 	    -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
 	    $@.sh >$@+ && \
diff --git a/git-bisect.sh b/git-bisect.sh
index e1f300b..786b7b9 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -33,16 +33,6 @@ require_work_tree
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
 
-sq() {
-	@@PERL@@ -e '
-		for (@ARGV) {
-			s/'\''/'\'\\\\\'\''/g;
-			print " '\''$_'\''";
-		}
-		print "\n";
-	' "$@"
-}
-
 bisect_autostart() {
 	test -s "$GIT_DIR/BISECT_START" || {
 		echo >&2 'You need to start by "git bisect start"'
@@ -107,7 +97,7 @@ bisect_start() {
 	for arg; do
 	    case "$arg" in --) has_double_dash=1; break ;; esac
 	done
-	orig_args=$(sq "$@")
+	orig_args=$(git rev-parse --sq-quote "$@")
 	bad_seen=0
 	eval=''
 	while [ $# -gt 0 ]; do
@@ -147,7 +137,7 @@ bisect_start() {
 	# Write new start state.
 	#
 	echo "$start_head" >"$GIT_DIR/BISECT_START" &&
-	sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
+	git rev-parse --sq-quote "$@" >"$GIT_DIR/BISECT_NAMES" &&
 	eval "$eval" &&
 	echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
 	#
@@ -199,7 +189,7 @@ bisect_skip() {
             *..*)
                 revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
             *)
-                revs=$(sq "$arg") ;;
+                revs=$(git rev-parse --sq-quote "$arg") ;;
 	    esac
             all="$all $revs"
         done
-- 
1.6.3.rc1.112.g17e25
Message 1 of 1 in “bisect: use "git rev-parse --sq-quote" instead of a custom "sq" function”
  1. 2/3 bisect: use "git rev-parse --sq-quote" instead of a custom "sq" functionChristian Couder, Apr 24, 2009

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.