Skip to content

Commit 2cb03e7

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

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

t/t7810-grep.sh

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,6 @@ test_expect_success 'log --all-match with multiple --grep uses intersection' '
495495
test_cmp expect actual
496496
'
497497

498-
test_expect_success 'log --grep --author implicitly uses all-match' '
499-
# grep matches initial and second but not third
500-
# author matches only initial and third
501-
git log --author="A U Thor" --grep=s --grep=l --format=%s >actual &&
502-
{
503-
echo initial
504-
} >expect &&
505-
test_cmp expect actual
506-
'
507-
508498
test_expect_success 'log with multiple --author uses union' '
509499
git log --author="Thor" --author="Aster" --format=%s >actual &&
510500
{
@@ -521,17 +511,33 @@ test_expect_success 'log --all-match with multiple --author still uses union' '
521511
test_cmp expect actual
522512
'
523513

524-
test_expect_success 'log with --grep and multiple --author uses all-match' '
525-
git log --author="Thor" --author="Night" --grep=i --format=%s >actual &&
514+
test_expect_success 'log --grep --author uses intersection' '
515+
# grep matches only third and fourth
516+
# author matches only initial and third
517+
git log --author="A U Thor" --grep=r --format=%s >actual &&
526518
{
527-
echo third && echo initial
519+
echo third
528520
} >expect &&
529521
test_cmp expect actual
530522
'
531523

532-
test_expect_success 'log with --grep and multiple --author uses all-match' '
533-
git log --author="Thor" --author="Night" --grep=q --format=%s >actual &&
534-
>expect &&
524+
test_expect_success 'log --grep --grep --author takes union of greps and intersects with author' '
525+
# grep matches initial and second but not third
526+
# author matches only initial and third
527+
git log --author="A U Thor" --grep=s --grep=l --format=%s >actual &&
528+
{
529+
echo initial
530+
} >expect &&
531+
test_cmp expect actual
532+
'
533+
534+
test_expect_success 'log --grep --author --author takes union of authors and intersects with grep' '
535+
# grep matches only initial and third
536+
# author matches all but second
537+
git log --author="Thor" --author="Night" --grep=i --format=%s >actual &&
538+
{
539+
echo third && echo initial
540+
} >expect &&
535541
test_cmp expect actual
536542
'
537543

0 commit comments

Comments
 (0)