зеркало из https://github.com/microsoft/git.git
tests: grep portability fixes
We try to avoid using the "-q" or "-e" options, as they are
largely useless, as explained in aadbe44f
.
There is one exception for "-e" here, which is in t7701 used
to produce an "or" of patterns. This can be rewritten as an
egrep pattern.
This patch also removes use of "grep -F" in favor of the
more widely available "fgrep".
[sp: Tested on AIX 5.3 by Mike Ralphson,
Tested on MinGW by Johannes Sixt]
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: Mike Ralphson <mike@abacus.co.uk>
Tested-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Родитель
c33912ae24
Коммит
87539416fd
|
@ -32,7 +32,7 @@ test_expect_success 'bad setup: invalid .git file format' '
|
|||
echo "git rev-parse accepted an invalid .git file"
|
||||
false
|
||||
fi &&
|
||||
if ! grep -qe "Invalid gitfile format" .err
|
||||
if ! grep "Invalid gitfile format" .err
|
||||
then
|
||||
echo "git rev-parse returned wrong error"
|
||||
false
|
||||
|
@ -46,7 +46,7 @@ test_expect_success 'bad setup: invalid .git file path' '
|
|||
echo "git rev-parse accepted an invalid .git file path"
|
||||
false
|
||||
fi &&
|
||||
if ! grep -qe "Not a git repository" .err
|
||||
if ! grep "Not a git repository" .err
|
||||
then
|
||||
echo "git rev-parse returned wrong error"
|
||||
false
|
||||
|
|
|
@ -171,7 +171,7 @@ test_expect_success 'git diff' '
|
|||
|
||||
test_expect_success 'git grep' '
|
||||
(cd repo.git/work/sub &&
|
||||
GIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep -q dir/tracked)
|
||||
GIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep dir/tracked)
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
|
@ -226,7 +226,7 @@ test_expect_success 'git add '\''fo\[ou\]bar'\'' ignores foobar' '
|
|||
git reset --hard &&
|
||||
touch fo\[ou\]bar foobar &&
|
||||
git add '\''fo\[ou\]bar'\'' &&
|
||||
git ls-files fo\[ou\]bar | grep -F fo\[ou\]bar &&
|
||||
git ls-files fo\[ou\]bar | fgrep fo\[ou\]bar &&
|
||||
! ( git ls-files foobar | grep foobar )
|
||||
'
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ test_expect_success 'am --keep really keeps the subject' '
|
|||
git am --keep patch4 &&
|
||||
! test -d .git/rebase-apply &&
|
||||
git cat-file commit HEAD |
|
||||
grep -q -F "Re: Re: Re: [PATCH 1/5 v2] third"
|
||||
fgrep "Re: Re: Re: [PATCH 1/5 v2] third"
|
||||
'
|
||||
|
||||
test_expect_success 'am -3 falls back to 3-way merge' '
|
||||
|
|
|
@ -53,7 +53,7 @@ test_expect_success 'checkout' '
|
|||
(
|
||||
cd test && git checkout b1
|
||||
) >actual &&
|
||||
grep -e "have 1 and 1 different" actual
|
||||
grep "have 1 and 1 different" actual
|
||||
'
|
||||
|
||||
test_expect_success 'status' '
|
||||
|
@ -63,7 +63,7 @@ test_expect_success 'status' '
|
|||
# reports nothing to commit
|
||||
test_must_fail git status
|
||||
) >actual &&
|
||||
grep -e "have 1 and 1 different" actual
|
||||
grep "have 1 and 1 different" actual
|
||||
'
|
||||
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ do
|
|||
'
|
||||
|
||||
test_expect_success "grep -c $L (no /dev/null)" '
|
||||
! git grep -c test $H | grep -q /dev/null
|
||||
! git grep -c test $H | grep /dev/null
|
||||
'
|
||||
|
||||
done
|
||||
|
|
|
@ -29,7 +29,7 @@ test_expect_success '-A option leaves unreachable objects unpacked' '
|
|||
git repack -A -d -l &&
|
||||
# verify objects are packed in repository
|
||||
test 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
||||
grep -e "^$fsha1 " -e "^$csha1 " -e "^$tsha1 " |
|
||||
egrep "^($fsha1|$csha1|$tsha1) " |
|
||||
sort | uniq | wc -l) &&
|
||||
git show $fsha1 &&
|
||||
git show $csha1 &&
|
||||
|
@ -41,7 +41,7 @@ test_expect_success '-A option leaves unreachable objects unpacked' '
|
|||
git repack -A -d -l &&
|
||||
# verify objects are retained unpacked
|
||||
test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
|
||||
grep -e "^$fsha1 " -e "^$csha1 " -e "^$tsha1 " |
|
||||
egrep "^($fsha1|$csha1|$tsha1) " |
|
||||
sort | uniq | wc -l) &&
|
||||
git show $fsha1 &&
|
||||
git show $csha1 &&
|
||||
|
|
|
@ -56,7 +56,7 @@ gitweb_run () {
|
|||
rm -f gitweb.log &&
|
||||
perl -- "$TEST_DIRECTORY/../gitweb/gitweb.perl" \
|
||||
>/dev/null 2>gitweb.log &&
|
||||
if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi
|
||||
if grep "^[[]" gitweb.log >/dev/null 2>&1; then false; else true; fi
|
||||
|
||||
# gitweb.log is left for debugging
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче