Skip to content

Commit 39f2e01

Browse files
Michael J Grubergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2cb03e7 commit 39f2e01

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

t/t7810-grep.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,16 @@ test_expect_success 'log --grep --grep --author takes union of greps and interse
531531
test_cmp expect actual
532532
'
533533

534+
test_expect_success 'log ---all-match -grep --author --author still takes union of authors and intersects with grep' '
535+
# grep matches only initial and third
536+
# author matches all but second
537+
git log --all-match --author="Thor" --author="Night" --grep=i --format=%s >actual &&
538+
{
539+
echo third && echo initial
540+
} >expect &&
541+
test_cmp expect actual
542+
'
543+
534544
test_expect_success 'log --grep --author --author takes union of authors and intersects with grep' '
535545
# grep matches only initial and third
536546
# author matches all but second
@@ -541,6 +551,16 @@ test_expect_success 'log --grep --author --author takes union of authors and int
541551
test_cmp expect actual
542552
'
543553

554+
test_expect_success 'log --all-match --grep --grep --author takes intersection' '
555+
# grep matches only third
556+
# author matches only initial and third
557+
git log --all-match --author="A U Thor" --grep=i --grep=r --format=%s >actual &&
558+
{
559+
echo third
560+
} >expect &&
561+
test_cmp expect actual
562+
'
563+
544564
test_expect_success 'grep with CE_VALID file' '
545565
git update-index --assume-unchanged t/t &&
546566
rm t/t &&

0 commit comments

Comments
 (0)