* [PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1).
@ 2008-03-28 22:40 Bernd Ahlers
2008-03-29 0:49 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Ahlers @ 2008-03-28 22:40 UTC (permalink / raw)
To: git
This fixes test errors on OpenBSD.
Signed-off-by: Bernd Ahlers <bernd@ba-net.org>
---
t/t4019-diff-wserror.sh | 28 ++++++++++++++--------------
t/t9200-git-cvsexportcommit.sh | 2 +-
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh
index 0d9cbb6..275b41a 100755
--- a/t/t4019-diff-wserror.sh
+++ b/t/t4019-diff-wserror.sh
@@ -22,8 +22,8 @@ blue_grep='7;34m' ;# ESC [ 7 ; 3 4 m
test_expect_success default '
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight normal >/dev/null &&
grep HT error >/dev/null &&
@@ -37,8 +37,8 @@ test_expect_success 'without -trail' '
git config core.whitespace -trail
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight normal >/dev/null &&
grep HT error >/dev/null &&
@@ -53,8 +53,8 @@ test_expect_success 'without -trail (attribute)' '
git config --unset core.whitespace
echo "F whitespace=-trail" >.gitattributes
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight normal >/dev/null &&
grep HT error >/dev/null &&
@@ -69,8 +69,8 @@ test_expect_success 'without -space' '
rm -f .gitattributes
git config core.whitespace -space
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight normal >/dev/null &&
grep HT normal >/dev/null &&
@@ -85,8 +85,8 @@ test_expect_success 'without -space (attribute)' '
git config --unset core.whitespace
echo "F whitespace=-space" >.gitattributes
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight normal >/dev/null &&
grep HT normal >/dev/null &&
@@ -101,8 +101,8 @@ test_expect_success 'with indent-non-tab only' '
rm -f .gitattributes
git config core.whitespace indent,-trailing,-space
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight error >/dev/null &&
grep HT normal >/dev/null &&
@@ -117,8 +117,8 @@ test_expect_success 'with indent-non-tab only (attribute)' '
git config --unset core.whitespace
echo "F whitespace=indent,-trailing,-space" >.gitattributes
git diff --color >output
- grep "$blue_grep" output >error
- grep -v "$blue_grep" output >normal
+ grep -a "$blue_grep" output >error
+ grep -a -v "$blue_grep" output >normal
grep Eight error >/dev/null &&
grep HT normal >/dev/null &&
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index 42b144b..d3bd48c 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -30,7 +30,7 @@ exit 1
check_entries () {
# $1 == directory, $2 == expected
- grep '^/' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
+ grep -a '^/' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual
if test -z "$2"
then
>expected
--
1.5.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1).
2008-03-28 22:40 [PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1) Bernd Ahlers
@ 2008-03-29 0:49 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2008-03-29 0:49 UTC (permalink / raw)
To: Bernd Ahlers; +Cc: git
On Fri, Mar 28, 2008 at 11:40:11PM +0100, Bernd Ahlers wrote:
> This fixes test errors on OpenBSD.
Nak. "grep -a" isn't portable. If you have binary goo to check, I think
the safest thing is to either generate it using printf (if it's short
and easy) or include the expected output in a test file (this is what I
did for t4020; see 53a5b443).
You could also potentially use git-grep for this, but I haven't looked
into how it handles "-a" (and in general, I think we try to avoid using
git tools as test infrastructure to avoid false positives; e.g., we
prefer using a system tool to compare expected output rather than
git-diff).
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-29 0:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-28 22:40 [PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1) Bernd Ahlers
2008-03-29 0:49 ` Jeff King
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).