From b327bf74bd631790918d6730404eb97baec267c9 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Fri, 14 Sep 2012 11:46:39 +0200 Subject: t7810-grep: bring log --grep tests in common form The log --grep tests generate the expected out in different ways. Make them all use command blocks so that subshells are avoided and the expected output is easier to grasp visually. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 24e9b1974d..180e998697 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -435,31 +435,41 @@ test_expect_success 'log grep setup' ' test_expect_success 'log grep (1)' ' git log --author=author --pretty=tformat:%s >actual && - ( echo third ; echo initial ) >expect && + { + echo third && echo initial + } >expect && test_cmp expect actual ' test_expect_success 'log grep (2)' ' git log --author=" * " -F --pretty=tformat:%s >actual && - ( echo second ) >expect && + { + echo second + } >expect && test_cmp expect actual ' test_expect_success 'log grep (3)' ' git log --author="^A U" --pretty=tformat:%s >actual && - ( echo third ; echo initial ) >expect && + { + echo third && echo initial + } >expect && test_cmp expect actual ' test_expect_success 'log grep (4)' ' git log --author="frotz\.com>$" --pretty=tformat:%s >actual && - ( echo second ) >expect && + { + echo second + } >expect && test_cmp expect actual ' test_expect_success 'log grep (5)' ' git log --author=Thor -F --pretty=tformat:%s >actual && - ( echo third ; echo initial ) >expect && + { + echo third && echo initial + } >expect && test_cmp expect actual ' @@ -473,7 +483,9 @@ test_expect_success 'log --grep --author implicitly uses all-match' ' # grep matches initial and second but not third # author matches only initial and third git log --author="A U Thor" --grep=s --grep=l --format=%s >actual && - echo initial >expect && + { + echo initial + } >expect && test_cmp expect actual ' -- cgit v1.2.3 From dfe3642515d3d2679bdc25c2be4d961201e9f095 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Fri, 14 Sep 2012 11:46:40 +0200 Subject: t7810-grep: test multiple --grep with and without --all-match Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 180e998697..b841909315 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -479,6 +479,22 @@ test_expect_success 'log grep (6)' ' test_cmp expect actual ' +test_expect_success 'log with multiple --grep uses union' ' + git log --grep=i --grep=r --format=%s >actual && + { + echo fourth && echo third && echo initial + } >expect && + test_cmp expect actual +' + +test_expect_success 'log --all-match with multiple --grep uses intersection' ' + git log --all-match --grep=i --grep=r --format=%s >actual && + { + echo third + } >expect && + test_cmp expect actual +' + test_expect_success 'log --grep --author implicitly uses all-match' ' # grep matches initial and second but not third # author matches only initial and third -- cgit v1.2.3 From 00f62a64d489592c97f6f171f9a19fdda530f3c5 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Fri, 14 Sep 2012 11:46:41 +0200 Subject: t7810-grep: test multiple --author with --all-match The "--all-match" option is about "--grep", and does not affect how "--author" or "--committer" limitation is applied. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index b841909315..be81d96e20 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -513,6 +513,14 @@ test_expect_success 'log with multiple --author uses union' ' test_cmp expect actual ' +test_expect_success 'log --all-match with multiple --author still uses union' ' + git log --all-match --author="Thor" --author="Aster" --format=%s >actual && + { + echo third && echo second && echo initial + } >expect && + test_cmp expect actual +' + test_expect_success 'log with --grep and multiple --author uses all-match' ' git log --author="Thor" --author="Night" --grep=i --format=%s >actual && { -- cgit v1.2.3 From 2cb03e76a0e65920a0790d5b128fde9185e0e8fe Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Fri, 14 Sep 2012 11:46:42 +0200 Subject: t7810-grep: test interaction of multiple --grep and --author options There are tests for this interaction already. Restructure slightly and avoid any claims about --all-match. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index be81d96e20..f6edb4d6dc 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -495,16 +495,6 @@ test_expect_success 'log --all-match with multiple --grep uses intersection' ' test_cmp expect actual ' -test_expect_success 'log --grep --author implicitly uses all-match' ' - # grep matches initial and second but not third - # author matches only initial and third - git log --author="A U Thor" --grep=s --grep=l --format=%s >actual && - { - echo initial - } >expect && - test_cmp expect actual -' - test_expect_success 'log with multiple --author uses union' ' git log --author="Thor" --author="Aster" --format=%s >actual && { @@ -521,17 +511,33 @@ test_expect_success 'log --all-match with multiple --author still uses union' ' test_cmp expect actual ' -test_expect_success 'log with --grep and multiple --author uses all-match' ' - git log --author="Thor" --author="Night" --grep=i --format=%s >actual && +test_expect_success 'log --grep --author uses intersection' ' + # grep matches only third and fourth + # author matches only initial and third + git log --author="A U Thor" --grep=r --format=%s >actual && { - echo third && echo initial + echo third } >expect && test_cmp expect actual ' -test_expect_success 'log with --grep and multiple --author uses all-match' ' - git log --author="Thor" --author="Night" --grep=q --format=%s >actual && - >expect && +test_expect_success 'log --grep --grep --author takes union of greps and intersects with author' ' + # grep matches initial and second but not third + # author matches only initial and third + git log --author="A U Thor" --grep=s --grep=l --format=%s >actual && + { + echo initial + } >expect && + test_cmp expect actual +' + +test_expect_success 'log --grep --author --author takes union of authors and intersects with grep' ' + # grep matches only initial and third + # author matches all but second + git log --author="Thor" --author="Night" --grep=i --format=%s >actual && + { + echo third && echo initial + } >expect && test_cmp expect actual ' -- cgit v1.2.3 From 39f2e017203695b9da2ad35589b0e58bcac6fdc8 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Fri, 14 Sep 2012 11:46:43 +0200 Subject: t7810-grep: test --all-match with multiple --grep and --author options The code used to have a bug that ignores "--all-match", that requires all "--grep" to have matched, when "--author" or "--committer" was used. Make sure the bug will not be reintroduced. Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano --- t/t7810-grep.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 't') diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index f6edb4d6dc..b5c488e3a5 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -531,6 +531,16 @@ test_expect_success 'log --grep --grep --author takes union of greps and interse test_cmp expect actual ' +test_expect_success 'log ---all-match -grep --author --author still takes union of authors and intersects with grep' ' + # grep matches only initial and third + # author matches all but second + git log --all-match --author="Thor" --author="Night" --grep=i --format=%s >actual && + { + echo third && echo initial + } >expect && + test_cmp expect actual +' + test_expect_success 'log --grep --author --author takes union of authors and intersects with grep' ' # grep matches only initial and third # author matches all but second @@ -541,6 +551,16 @@ test_expect_success 'log --grep --author --author takes union of authors and int test_cmp expect actual ' +test_expect_success 'log --all-match --grep --grep --author takes intersection' ' + # grep matches only third + # author matches only initial and third + git log --all-match --author="A U Thor" --grep=i --grep=r --format=%s >actual && + { + echo third + } >expect && + test_cmp expect actual +' + test_expect_success 'grep with CE_VALID file' ' git update-index --assume-unchanged t/t && rm t/t && -- cgit v1.2.3