From aadbe44f883859536c5320e0ac1d6ed122c45671 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 12 Mar 2008 17:32:17 -0400 Subject: grep portability fix: don't use "-e" or "-q" System V versions of grep (such as Solaris /usr/bin/grep) don't understand either of these options. git's usage of "grep -e pattern" fell into one of two categories: 1. equivalent to "grep pattern". -e is only useful here if the pattern begins with a "-", but all of the patterns are hardcoded and do not begin with a dash. 2. stripping comments and blank lines with grep -v -e "^$" -e "^#" We can fortunately do this in the affirmative as grep '^[^#]' Uses of "-q" can be replaced with redirection to /dev/null. In many tests, however, "grep -q" is used as "if this string is in the expected output, we are OK". In this case, it is fine to just remove the "-q" entirely; it simply makes the "verbose" mode of the test slightly more verbose. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- git-submodule.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git-submodule.sh') diff --git a/git-submodule.sh b/git-submodule.sh index 7171cb60ab..ceb22952aa 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -230,7 +230,7 @@ cmd_init() shift done - git ls-files --stage -- "$@" | grep -e '^160000 ' | + git ls-files --stage -- "$@" | grep '^160000 ' | while read mode sha1 stage path do # Skip already registered paths @@ -284,7 +284,7 @@ cmd_update() shift done - git ls-files --stage -- "$@" | grep -e '^160000 ' | + git ls-files --stage -- "$@" | grep '^160000 ' | while read mode sha1 stage path do name=$(module_name "$path") || exit @@ -367,7 +367,7 @@ cmd_status() shift done - git ls-files --stage -- "$@" | grep -e '^160000 ' | + git ls-files --stage -- "$@" | grep '^160000 ' | while read mode sha1 stage path do name=$(module_name "$path") || exit -- cgit v1.2.3