summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e85fe4d)
raw | patch | inline | side by side (parent: e85fe4d)
author | Jeff King <peff@peff.net> | |
Wed, 12 Mar 2008 21:32:17 +0000 (17:32 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 13 Mar 2008 07:57:52 +0000 (00:57 -0700) |
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>
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>
index c2bedd622c7238359ab88592857bb50eeaa568f8..4c3280a76ebe94c21fd4078c57ab03b6399d16ae 100755 (executable)
sed -e 1q < "$TODO" >> "$DONE"
sed -e 1d < "$TODO" >> "$TODO".new
mv -f "$TODO".new "$TODO"
- count=$(($(grep -ve '^$' -e '^#' < "$DONE" | wc -l)))
- total=$(($count+$(grep -ve '^$' -e '^#' < "$TODO" | wc -l)))
+ count=$(grep -c '^[^#]' < "$DONE")
+ total=$(($count+$(grep -c '^[^#]' < "$TODO")))
if test "$last_count" != "$count"
then
last_count=$count
}
has_action () {
- grep -vqe '^$' -e '^#' "$1"
+ grep '^[^#]' "$1" >/dev/null
}
pick_one () {
diff --git a/git-submodule.sh b/git-submodule.sh
index 7171cb60ab4e6a49b84500bde43c04ea40501d6c..ceb22952aa940e1a13f0b6ccbf30fdc19bd9eba2 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
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
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
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
diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh
index 818c8621f239dd7f61a2d79e9c65779dbbf9f6ef..3ecdd6626aa58f7e2bbe0addb292b57dd2168a14 100755 (executable)
--- a/t/t0030-stripspace.sh
+++ b/t/t0030-stripspace.sh
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 \
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 \
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 \
index 049aa375381b5929d1f35b7316c3fe6a647e4f93..f09823106fa75f668291d94039746adac16b6880 100755 (executable)
diff -u expect .git/.dotest-merge/patch &&
diff -u expect2 file1 &&
test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) &&
- test 0 = $(grep -ve "^#" -e "^$" < .git/.dotest-merge/git-rebase-todo |
- wc -l)
+ test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo)
'
test_expect_success 'abort' '
diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh
index f2803206f1b170adef4e05d3aa46b01084adf470..278075823bbf4656ec08e844e79e6b25f0f2f292 100755 (executable)
--- a/t/t3800-mktag.sh
+++ b/t/t3800-mktag.sh
expect="$2"
test_expect_success "$1" '
( ! git-mktag <tag.sig 2>message ) &&
- grep -q "$expect" message
+ grep "$expect" message
'
}
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 2d0c07fd6a38d786efc895bc5c5c0d7dd268b31f..2b6b6e3f71613d807aa4ebfa48eebe5f73d2b980 100755 (executable)
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
cd .. &&
git-clone parent child && cd child && git-push --all &&
cd ../parent &&
- git-branch -a >branches && ! grep -q origin/master branches
+ git-branch -a >branches && ! grep origin/master branches
'
rewound_push_setup() {
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index e00607490bcb0439c6557003a3419d84823a8f00..70b802ba3d4f9d985126158b1df615859986bc81 100755 (executable)
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
test_expect_success 'status (1)' '
- grep -e "use \"git rm --cached <file>\.\.\.\" to unstage" output
+ grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
'
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 5d166280cbb93ef4e22f04090d510bfd5b09fb7a..590505bea61f9ca63c2eac2045e989ebc732c193 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
git merge --summary c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 &&
verify_parents $c1 $c2 &&
- if ! grep -e "^ file | *2 +-$" diffstat.txt
+ if ! grep "^ file | *2 +-$" diffstat.txt
then
echo "[OOPS] diffstat was not generated"
fi
git merge -n c2 >diffstat.txt &&
verify_merge file result.1-5 msg.1-5 &&
verify_parents $c1 $c2 &&
- if grep -e "^ file | *2 +-$" diffstat.txt
+ if grep "^ file | *2 +-$" diffstat.txt
then
echo "[OOPS] diffstat was generated"
false
index 0a20971ebb693250ab1fa78cdd9ec269e7129f6e..e82b365fade5aaf48d58d80783bedc2e1be422b9 100755 (executable)
test_expect_success 'pserver authentication' \
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'pserver authentication failure (non-anonymous user)' \
'if cat request-git | git-cvsserver pserver >log 2>&1
else
true
fi &&
- tail -n1 log | grep -q "^I HATE YOU$"'
+ tail -n1 log | grep "^I HATE YOU$"'
test_expect_success 'pserver authentication (login)' \
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
'if cat login-git | git-cvsserver pserver >log 2>&1
else
true
fi &&
- tail -n1 log | grep -q "^I HATE YOU$"'
+ tail -n1 log | grep "^I HATE YOU$"'
# misuse pserver authentication for testing of req_Root
else
true
fi &&
- tail log | grep -q "^error 1 Root must be an absolute pathname$"'
+ tail log | grep "^error 1 Root must be an absolute pathname$"'
test_expect_success 'req_Root failure (conflicting roots)' \
'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
- tail log | grep -q "^error 1 Conflicting roots specified$"'
+ tail log | grep "^error 1 Conflicting roots specified$"'
test_expect_success 'req_Root (strict paths)' \
'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (strict-paths)' '
! cat request-anonymous |
test_expect_success 'req_Root (w/o strict-paths)' \
'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (w/o strict-paths)' '
! cat request-anonymous |
test_expect_success 'req_Root (base-path)' \
'cat request-base | git-cvsserver --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (base-path)' '
! cat request-anonymous |
test_expect_success 'req_Root (export-all)' \
'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
test_expect_success 'req_Root failure (export-all w/o whitelist)' \
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
test_expect_success 'req_Root (everything together)' \
'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 &&
- tail -n1 log | grep -q "^I LOVE YOU$"'
+ tail -n1 log | grep "^I LOVE YOU$"'
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
else
true
fi &&
- cat cvs.log | grep -q "GITCVS emulation disabled" &&
+ grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2'
rm -fr cvswork2
else
true
fi &&
- cat cvs.log | grep -q "GITCVS emulation disabled" &&
+ grep "GITCVS emulation disabled" cvs.log &&
test ! -d cvswork2'
rm -fr cvswork2