{"thread":{"id":"12908","subject":"[PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1).","startedAt":"2008-03-28T22:40:11Z","lastAt":"2008-03-29T00:49:08Z","messageCount":2,"participants":["Bernd Ahlers","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"73295","messageId":"20080328224011.GB5486@dengar.tuneafish.de","threadId":"12908","inReplyTo":null,"subject":"[PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1).","fromName":"Bernd Ahlers","fromEmail":"bernd@ba-net.org","sentAt":"2008-03-28T22:40:11Z","receivedAt":"2008-03-28T22:40:11Z","isPatch":true,"sender":{"key":"bernd@ba-net.org","avatar":"https://gravatar.com/avatar/04df7031bc24178cd81d8d4236f02a8409f916c255a66d09bf7137db2d0f550c?d=mp&s=160"},"body":"This fixes test errors on OpenBSD.\n\nSigned-off-by: Bernd Ahlers <bernd@ba-net.org>\n---\n t/t4019-diff-wserror.sh        |   28 ++++++++++++++--------------\n t/t9200-git-cvsexportcommit.sh |    2 +-\n 2 files changed, 15 insertions(+), 15 deletions(-)\n\ndiff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh\nindex 0d9cbb6..275b41a 100755\n--- a/t/t4019-diff-wserror.sh\n+++ b/t/t4019-diff-wserror.sh\n@@ -22,8 +22,8 @@ blue_grep='7;34m' ;# ESC [ 7 ; 3 4 m\n test_expect_success default '\n \n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight normal >/dev/null &&\n \tgrep HT error >/dev/null &&\n@@ -37,8 +37,8 @@ test_expect_success 'without -trail' '\n \n \tgit config core.whitespace -trail\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight normal >/dev/null &&\n \tgrep HT error >/dev/null &&\n@@ -53,8 +53,8 @@ test_expect_success 'without -trail (attribute)' '\n \tgit config --unset core.whitespace\n \techo \"F whitespace=-trail\" >.gitattributes\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight normal >/dev/null &&\n \tgrep HT error >/dev/null &&\n@@ -69,8 +69,8 @@ test_expect_success 'without -space' '\n \trm -f .gitattributes\n \tgit config core.whitespace -space\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight normal >/dev/null &&\n \tgrep HT normal >/dev/null &&\n@@ -85,8 +85,8 @@ test_expect_success 'without -space (attribute)' '\n \tgit config --unset core.whitespace\n \techo \"F whitespace=-space\" >.gitattributes\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight normal >/dev/null &&\n \tgrep HT normal >/dev/null &&\n@@ -101,8 +101,8 @@ test_expect_success 'with indent-non-tab only' '\n \trm -f .gitattributes\n \tgit config core.whitespace indent,-trailing,-space\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight error >/dev/null &&\n \tgrep HT normal >/dev/null &&\n@@ -117,8 +117,8 @@ test_expect_success 'with indent-non-tab only (attribute)' '\n \tgit config --unset core.whitespace\n \techo \"F whitespace=indent,-trailing,-space\" >.gitattributes\n \tgit diff --color >output\n-\tgrep \"$blue_grep\" output >error\n-\tgrep -v \"$blue_grep\" output >normal\n+\tgrep -a \"$blue_grep\" output >error\n+\tgrep -a -v \"$blue_grep\" output >normal\n \n \tgrep Eight error >/dev/null &&\n \tgrep HT normal >/dev/null &&\ndiff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh\nindex 42b144b..d3bd48c 100755\n--- a/t/t9200-git-cvsexportcommit.sh\n+++ b/t/t9200-git-cvsexportcommit.sh\n@@ -30,7 +30,7 @@ exit 1\n \n check_entries () {\n \t# $1 == directory, $2 == expected\n-\tgrep '^/' \"$1/CVS/Entries\" | sort | cut -d/ -f2,3,5 >actual\n+\tgrep -a '^/' \"$1/CVS/Entries\" | sort | cut -d/ -f2,3,5 >actual\n \tif test -z \"$2\"\n \tthen\n \t\t>expected\n-- \n1.5.4.5\n"},{"id":"73297","messageId":"20080329004908.GA9878@coredump.intra.peff.net","threadId":"12908","inReplyTo":"20080328224011.GB5486@dengar.tuneafish.de","subject":"Re: [PATCH] Use 'grep -a' to fix some errors with non-GNU grep(1).","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-03-29T00:49:08Z","receivedAt":"2008-03-29T00:49:08Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Mar 28, 2008 at 11:40:11PM +0100, Bernd Ahlers wrote:\n\n> This fixes test errors on OpenBSD.\n\nNak. \"grep -a\" isn't portable. If you have binary goo to check, I think\nthe safest thing is to either generate it using printf (if it's short\nand easy) or include the expected output in a test file (this is what I\ndid for t4020; see 53a5b443).\n\nYou could also potentially use git-grep for this, but I haven't looked\ninto how it handles \"-a\" (and in general, I think we try to avoid using\ngit tools as test infrastructure to avoid false positives; e.g., we\nprefer using a system tool to compare expected output rather than\ngit-diff).\n\n-Peff\n"}]}