{"thread":{"id":"15719","subject":"[PATCH] tests: grep portability fixes","startedAt":"2008-09-30T08:03:55Z","lastAt":"2008-09-30T12:45:22Z","messageCount":7,"participants":["Jeff King","Andreas Ericsson","Johannes Sixt","Mike Ralphson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"91904","messageId":"20080930080355.GA19605@sigill.intra.peff.net","threadId":"15719","inReplyTo":null,"subject":"[PATCH] tests: grep portability fixes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-30T08:03:55Z","receivedAt":"2008-09-30T08:03:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We try to avoid using the \"-q\" or \"-e\" options, as they are\nlargely useless, as explained in aadbe44f.\n\nThere is one exception for \"-e\" here, which is in t7701 used\nto produce an \"or\" of patterns. This can be rewritten as an\negrep pattern.\n\nThis patch also removes use of \"grep -F\" in favor of the\nmore widely available \"fgrep\".\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nThese are fallouts from getting (most of) the tests to pass\non Solaris.\n\n t/t0002-gitfile.sh                     |    4 ++--\n t/t1501-worktree.sh                    |    2 +-\n t/t3700-add.sh                         |    2 +-\n t/t4150-am.sh                          |    2 +-\n t/t6040-tracking-info.sh               |    4 ++--\n t/t7002-grep.sh                        |    2 +-\n t/t7701-repack-unpack-unreachable.sh   |    4 ++--\n t/t9500-gitweb-standalone-no-errors.sh |    2 +-\n 8 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\nindex 4db4ac4..cb14425 100755\n--- a/t/t0002-gitfile.sh\n+++ b/t/t0002-gitfile.sh\n@@ -32,7 +32,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n \t\techo \"git rev-parse accepted an invalid .git file\"\n \t\tfalse\n \tfi &&\n-\tif ! grep -qe \"Invalid gitfile format\" .err\n+\tif ! grep \"Invalid gitfile format\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\n@@ -46,7 +46,7 @@ test_expect_success 'bad setup: invalid .git file path' '\n \t\techo \"git rev-parse accepted an invalid .git file path\"\n \t\tfalse\n \tfi &&\n-\tif ! grep -qe \"Not a git repository\" .err\n+\tif ! grep \"Not a git repository\" .err\n \tthen\n \t\techo \"git rev-parse returned wrong error\"\n \t\tfalse\ndiff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh\nindex c039ee3..f6a6f83 100755\n--- a/t/t1501-worktree.sh\n+++ b/t/t1501-worktree.sh\n@@ -171,7 +171,7 @@ test_expect_success 'git diff' '\n \n test_expect_success 'git grep' '\n \t(cd repo.git/work/sub &&\n-\tGIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep -q dir/tracked)\n+\tGIT_DIR=../.. GIT_WORK_TREE=.. git grep -l changed | grep dir/tracked)\n '\n \n test_done\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 2ac93a3..9f6454d 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -226,7 +226,7 @@ test_expect_success 'git add '\\''fo\\[ou\\]bar'\\'' ignores foobar' '\n \tgit reset --hard &&\n \ttouch fo\\[ou\\]bar foobar &&\n \tgit add '\\''fo\\[ou\\]bar'\\'' &&\n-\tgit ls-files fo\\[ou\\]bar | grep -F fo\\[ou\\]bar &&\n+\tgit ls-files fo\\[ou\\]bar | fgrep fo\\[ou\\]bar &&\n \t! ( git ls-files foobar | grep foobar )\n '\n \ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 1be5fb3..796f795 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -165,7 +165,7 @@ test_expect_success 'am --keep really keeps the subject' '\n \tgit am --keep patch4 &&\n \t! test -d .git/rebase-apply &&\n \tgit cat-file commit HEAD |\n-\t\tgrep -q -F \"Re: Re: Re: [PATCH 1/5 v2] third\"\n+\t\tfgrep \"Re: Re: Re: [PATCH 1/5 v2] third\"\n '\n \n test_expect_success 'am -3 falls back to 3-way merge' '\ndiff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh\nindex aac212e..ba90601 100755\n--- a/t/t6040-tracking-info.sh\n+++ b/t/t6040-tracking-info.sh\n@@ -53,7 +53,7 @@ test_expect_success 'checkout' '\n \t(\n \t\tcd test && git checkout b1\n \t) >actual &&\n-\tgrep -e \"have 1 and 1 different\" actual\n+\tgrep \"have 1 and 1 different\" actual\n '\n \n test_expect_success 'status' '\n@@ -63,7 +63,7 @@ test_expect_success 'status' '\n \t\t# reports nothing to commit\n \t\ttest_must_fail git status\n \t) >actual &&\n-\tgrep -e \"have 1 and 1 different\" actual\n+\tgrep \"have 1 and 1 different\" actual\n '\n \n \ndiff --git a/t/t7002-grep.sh b/t/t7002-grep.sh\nindex 5e359cb..18fe6f2 100755\n--- a/t/t7002-grep.sh\n+++ b/t/t7002-grep.sh\n@@ -109,7 +109,7 @@ do\n \t'\n \n \ttest_expect_success \"grep -c $L (no /dev/null)\" '\n-\t\t! git grep -c test $H | grep -q /dev/null\n+\t\t! git grep -c test $H | grep /dev/null\n         '\n \n done\ndiff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh\nindex 531dac0..b48046e 100755\n--- a/t/t7701-repack-unpack-unreachable.sh\n+++ b/t/t7701-repack-unpack-unreachable.sh\n@@ -29,7 +29,7 @@ test_expect_success '-A option leaves unreachable objects unpacked' '\n \tgit repack -A -d -l &&\n \t# verify objects are packed in repository\n \ttest 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |\n-\t\t   grep -e \"^$fsha1 \" -e \"^$csha1 \" -e \"^$tsha1 \" |\n+\t\t   egrep \"^($fsha1|$csha1|$tsha1) \" |\n \t\t   sort | uniq | wc -l) &&\n \tgit show $fsha1 &&\n \tgit show $csha1 &&\n@@ -41,7 +41,7 @@ test_expect_success '-A option leaves unreachable objects unpacked' '\n \tgit repack -A -d -l &&\n \t# verify objects are retained unpacked\n \ttest 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |\n-\t\t   grep -e \"^$fsha1 \" -e \"^$csha1 \" -e \"^$tsha1 \" |\n+\t\t   egrep \"^($fsha1|$csha1|$tsha1) \" |\n \t\t   sort | uniq | wc -l) &&\n \tgit show $fsha1 &&\n \tgit show $csha1 &&\ndiff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh\nindex 46ba19b..07117a8 100755\n--- a/t/t9500-gitweb-standalone-no-errors.sh\n+++ b/t/t9500-gitweb-standalone-no-errors.sh\n@@ -56,7 +56,7 @@ gitweb_run () {\n \trm -f gitweb.log &&\n \tperl -- \"$TEST_DIRECTORY/../gitweb/gitweb.perl\" \\\n \t\t>/dev/null 2>gitweb.log &&\n-\tif grep -q -s \"^[[]\" gitweb.log >/dev/null; then false; else true; fi\n+\tif grep \"^[[]\" gitweb.log >/dev/null 2>&1; then false; else true; fi\n \n \t# gitweb.log is left for debugging\n }\n-- \n1.6.0.2.517.g4d51\n"},{"id":"91917","messageId":"48E1FB76.1040500@op5.se","threadId":"15719","inReplyTo":"20080930080355.GA19605@sigill.intra.peff.net","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-09-30T10:12:06Z","receivedAt":"2008-09-30T10:12:06Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Jeff King wrote:\n> We try to avoid using the \"-q\" or \"-e\" options, as they are\n> largely useless, as explained in aadbe44f.\n> \n> There is one exception for \"-e\" here, which is in t7701 used\n> to produce an \"or\" of patterns. This can be rewritten as an\n> egrep pattern.\n> \n> This patch also removes use of \"grep -F\" in favor of the\n> more widely available \"fgrep\".\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> \n> diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh\n> index 4db4ac4..cb14425 100755\n> --- a/t/t0002-gitfile.sh\n> +++ b/t/t0002-gitfile.sh\n> @@ -32,7 +32,7 @@ test_expect_success 'bad setup: invalid .git file format' '\n>  \t\techo \"git rev-parse accepted an invalid .git file\"\n>  \t\tfalse\n>  \tfi &&\n> -\tif ! grep -qe \"Invalid gitfile format\" .err\n> +\tif ! grep \"Invalid gitfile format\" .err\n\nDoesn't output need to be redirected when you drop '-q'?\n\nOther than that, this looks good after a quick scan.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"91918","messageId":"48E1FE8F.8030700@viscovery.net","threadId":"15719","inReplyTo":"20080930080355.GA19605@sigill.intra.peff.net","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-30T10:25:19Z","receivedAt":"2008-09-30T10:25:19Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Jeff King schrieb:\n> We try to avoid using the \"-q\" or \"-e\" options, as they are\n> largely useless, as explained in aadbe44f.\n> \n> There is one exception for \"-e\" here, which is in t7701 used\n> to produce an \"or\" of patterns. This can be rewritten as an\n> egrep pattern.\n> \n> This patch also removes use of \"grep -F\" in favor of the\n> more widely available \"fgrep\".\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> These are fallouts from getting (most of) the tests to pass\n> on Solaris.\n> \n>  t/t0002-gitfile.sh                     |    4 ++--\n>  t/t1501-worktree.sh                    |    2 +-\n>  t/t3700-add.sh                         |    2 +-\n>  t/t4150-am.sh                          |    2 +-\n>  t/t6040-tracking-info.sh               |    4 ++--\n>  t/t7002-grep.sh                        |    2 +-\n>  t/t7701-repack-unpack-unreachable.sh   |    4 ++--\n>  t/t9500-gitweb-standalone-no-errors.sh |    2 +-\n>  8 files changed, 11 insertions(+), 11 deletions(-)\n\nWorks here:\n\nTested-by: Johannes Sixt <johannes.sixt@telecom.at> (MinGW)\n\n-- Hannes\n"},{"id":"91919","messageId":"48E1FF6D.1050907@viscovery.net","threadId":"15719","inReplyTo":"48E1FB76.1040500@op5.se","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-09-30T10:29:01Z","receivedAt":"2008-09-30T10:29:01Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Andreas Ericsson schrieb:\n> Jeff King wrote:\n>> -    if ! grep -qe \"Invalid gitfile format\" .err\n>> +    if ! grep \"Invalid gitfile format\" .err\n> \n> Doesn't output need to be redirected when you drop '-q'?\n\nIn standard mode, the test output is directed to /dev/null anyway, and in\nverbose mode the extra output doesn't hurt at all, and is usually useful\nbecause you know that a pattern matched.\n\n-- Hannes\n"},{"id":"91929","messageId":"e2b179460809300410q47592f63y7f7ec626007ad838@mail.gmail.com","threadId":"15719","inReplyTo":"20080930080355.GA19605@sigill.intra.peff.net","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Mike Ralphson","fromEmail":"mike.ralphson@gmail.com","sentAt":"2008-09-30T11:10:19Z","receivedAt":"2008-09-30T11:10:19Z","isPatch":true,"sender":{"key":"mike.ralphson@gmail.com","avatar":"https://avatars.githubusercontent.com/u/21603?v=4"},"body":"2008/9/30 Jeff King <peff@peff.net>:\n> We try to avoid using the \"-q\" or \"-e\" options, as they are\n> largely useless, as explained in aadbe44f.\n>\n> There is one exception for \"-e\" here, which is in t7701 used\n> to produce an \"or\" of patterns. This can be rewritten as an\n> egrep pattern.\n>\n> This patch also removes use of \"grep -F\" in favor of the\n> more widely available \"fgrep\".\n\nWorks here too (AIX 5.3)\n\nTested-by: Mike Ralphson <mike@abacus.co.uk>\n"},{"id":"91932","messageId":"20080930124413.GA22078@coredump.intra.peff.net","threadId":"15719","inReplyTo":"e2b179460809300410q47592f63y7f7ec626007ad838@mail.gmail.com","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-30T12:44:13Z","receivedAt":"2008-09-30T12:44:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 30, 2008 at 12:10:19PM +0100, Mike Ralphson wrote:\n\n> > There is one exception for \"-e\" here, which is in t7701 used\n> > to produce an \"or\" of patterns. This can be rewritten as an\n> > egrep pattern.\n> >\n> > This patch also removes use of \"grep -F\" in favor of the\n> > more widely available \"fgrep\".\n> \n> Works here too (AIX 5.3)\n> \n> Tested-by: Mike Ralphson <mike@abacus.co.uk>\n\nThanks Mike and Johannes. The dropping of \"-e\" and \"-q\" we had done\nbefore, but this was our first use of egrep and fgrep. From my\n(admittedly limited) knowledge, I think they are fine, but it is nice to\nhave some confirmation.\n\n-Peff\n"},{"id":"91933","messageId":"20080930124522.GA22182@coredump.intra.peff.net","threadId":"15719","inReplyTo":"48E1FF6D.1050907@viscovery.net","subject":"Re: [PATCH] tests: grep portability fixes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-09-30T12:45:22Z","receivedAt":"2008-09-30T12:45:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 30, 2008 at 12:29:01PM +0200, Johannes Sixt wrote:\n\n> Andreas Ericsson schrieb:\n> > Jeff King wrote:\n> >> -    if ! grep -qe \"Invalid gitfile format\" .err\n> >> +    if ! grep \"Invalid gitfile format\" .err\n> > \n> > Doesn't output need to be redirected when you drop '-q'?\n> \n> In standard mode, the test output is directed to /dev/null anyway, and in\n> verbose mode the extra output doesn't hurt at all, and is usually useful\n> because you know that a pattern matched.\n\nExactly. This is the more of the same as aadbe44f (grep portability fix:\ndon't use \"e\" or \"-q\") but I was too lazy to rewrite the justification\ncompletely (but I did reference it).\n\n-Peff\n"}]}