git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-grep: convert from bash to sh
@ 2005-12-18 13:26 Timo Hirvonen
  2005-12-18 14:56 ` Petr Baudis
  2005-12-18 19:57 ` Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: Timo Hirvonen @ 2005-12-18 13:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


sh does not support arrays so we have to use eval instead.

Signed-off-by: Timo Hirvonen <tihirvon@gmail.com>

---

 git-grep.sh |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

11c29a066288c5f05a67ff0d46e9ce17cd7a37da
diff --git a/git-grep.sh b/git-grep.sh
index 2ed8e95..2f0a297 100755
--- a/git-grep.sh
+++ b/git-grep.sh
@@ -8,21 +8,21 @@ SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
 pattern=
-flags=()
-git_flags=()
+flags=
+git_flags=
 while : ; do
 	case "$1" in
 	--cached|--deleted|--others|--killed|\
 	--ignored|--exclude=*|\
 	--exclude-from=*|\--exclude-per-directory=*)
-		git_flags=("${git_flags[@]}" "$1")
+		git_flags="$git_flags '$1'"
 		;;
 	-e)
 		pattern="$2"
 		shift
 		;;
 	-A|-B|-C|-D|-d|-f|-m)
-		flags=("${flags[@]}" "$1" "$2")
+		flags="$flags '$1' '$2'"
 		shift
 		;;
 	--)
@@ -31,7 +31,7 @@ while : ; do
 		break
 		;;
 	-*)
-		flags=("${flags[@]}" "$1")
+		flags="$flags '$1'"
 		;;
 	*)
 		if [ -z "$pattern" ]; then
@@ -46,5 +46,5 @@ done
 [ "$pattern" ] || {
 	usage
 }
-git-ls-files -z "${git_flags[@]}" "$@" |
-	xargs -0 grep "${flags[@]}" -e "$pattern"
+eval git-ls-files -z "$git_flags" '"$@"' |
+	eval xargs -0 grep "$flags" -e '"$pattern"'
-- 
0.99.9.GIT

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-18 20:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-18 13:26 [PATCH] git-grep: convert from bash to sh Timo Hirvonen
2005-12-18 14:56 ` Petr Baudis
2005-12-18 19:37   ` Junio C Hamano
2005-12-18 19:57 ` Linus Torvalds
2005-12-18 20:18   ` Timo Hirvonen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).