summaryrefslogtreecommitdiff
path: root/t/t0030-stripspace.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-03-12 21:32:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-03-13 07:57:52 (GMT)
commitaadbe44f883859536c5320e0ac1d6ed122c45671 (patch)
tree5552c7d0999106d0198ed59403b21dcc1c5111e6 /t/t0030-stripspace.sh
parente85fe4d85bc7654af20ccf8054ab6922665405e5 (diff)
downloadgit-aadbe44f883859536c5320e0ac1d6ed122c45671.zip
git-aadbe44f883859536c5320e0ac1d6ed122c45671.tar.gz
git-aadbe44f883859536c5320e0ac1d6ed122c45671.tar.bz2
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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0030-stripspace.sh')
-rwxr-xr-xt/t0030-stripspace.sh34
1 files changed, 17 insertions, 17 deletions
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index 818c862..3ecdd66 100755
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
@@ -245,12 +245,12 @@ test_expect_success \
test_expect_success \
'text plus spaces without newline at end should not show spaces' '
- ! (printf "$ttt$sss" | git stripspace | grep -q " ") &&
- ! (printf "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
- ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
- ! (printf "$ttt$sss$sss" | git stripspace | grep -q " ") &&
- ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
- ! (printf "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
+ ! (printf "$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'
test_expect_success \
@@ -282,12 +282,12 @@ test_expect_success \
test_expect_success \
'text plus spaces at end should not show spaces' '
- ! (echo "$ttt$sss" | git stripspace | grep -q " ") &&
- ! (echo "$ttt$ttt$sss" | git stripspace | grep -q " ") &&
- ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " ") &&
- ! (echo "$ttt$sss$sss" | git stripspace | grep -q " ") &&
- ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " ") &&
- ! (echo "$ttt$sss$sss$sss" | git stripspace | grep -q " ")
+ ! (echo "$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (echo "$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (echo "$ttt$ttt$ttt$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (echo "$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (echo "$ttt$ttt$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (echo "$ttt$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'
test_expect_success \
@@ -341,11 +341,11 @@ test_expect_success \
test_expect_success \
'spaces without newline at end should not show spaces' '
- ! (printf "" | git stripspace | grep -q " ") &&
- ! (printf "$sss" | git stripspace | grep -q " ") &&
- ! (printf "$sss$sss" | git stripspace | grep -q " ") &&
- ! (printf "$sss$sss$sss" | git stripspace | grep -q " ") &&
- ! (printf "$sss$sss$sss$sss" | git stripspace | grep -q " ")
+ ! (printf "" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$sss$sss$sss" | git stripspace | grep " " >/dev/null) &&
+ ! (printf "$sss$sss$sss$sss" | git stripspace | grep " " >/dev/null)
'
test_expect_success \