Skip to content

Commit de52f5a

Browse files
chriscoolgitster
authored andcommitted
bisect: use "git rev-parse --sq-quote" instead of a custom "sq" function
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 5032537 commit de52f5a

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,6 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
12481248
$(QUIET_GEN)$(RM) $@ $@+ && \
12491249
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
12501250
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
1251-
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
12521251
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
12531252
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
12541253
$@.sh >$@+ && \

git-bisect.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ require_work_tree
3333
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
3434
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
3535

36-
sq() {
37-
@@PERL@@ -e '
38-
for (@ARGV) {
39-
s/'\''/'\'\\\\\'\''/g;
40-
print " '\''$_'\''";
41-
}
42-
print "\n";
43-
' "$@"
44-
}
45-
4636
bisect_autostart() {
4737
test -s "$GIT_DIR/BISECT_START" || {
4838
echo >&2 'You need to start by "git bisect start"'
@@ -107,7 +97,7 @@ bisect_start() {
10797
for arg; do
10898
case "$arg" in --) has_double_dash=1; break ;; esac
10999
done
110-
orig_args=$(sq "$@")
100+
orig_args=$(git rev-parse --sq-quote "$@")
111101
bad_seen=0
112102
eval=''
113103
while [ $# -gt 0 ]; do
@@ -147,7 +137,7 @@ bisect_start() {
147137
# Write new start state.
148138
#
149139
echo "$start_head" >"$GIT_DIR/BISECT_START" &&
150-
sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
140+
git rev-parse --sq-quote "$@" >"$GIT_DIR/BISECT_NAMES" &&
151141
eval "$eval" &&
152142
echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
153143
#
@@ -199,7 +189,7 @@ bisect_skip() {
199189
*..*)
200190
revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
201191
*)
202-
revs=$(sq "$arg") ;;
192+
revs=$(git rev-parse --sq-quote "$arg") ;;
203193
esac
204194
all="$all $revs"
205195
done

0 commit comments

Comments
 (0)