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 <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber committed
Sep 14, 2012 at 11:46 UTC
39f2e017203695b9da2ad35589b0e58bcac6fdc8
1 file changed
+20
t/t7810-grep.sh
+20
@@ -531,6 +531,16 @@ test_expect_success 'log --grep --grep --author takes union of greps and interse
531
test_cmp expect actual
532
'
533
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
+
544
test_expect_success 'log --grep --author --author takes union of authors and intersects with grep' '
545
# grep matches only initial and third
546
# author matches all but second
@@ -541,6 +551,16 @@ test_expect_success 'log --grep --author --author takes union of authors and int
551
test_cmp expect actual
552
'
553
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
+
564
test_expect_success 'grep with CE_VALID file' '
565
git update-index --assume-unchanged t/t &&
566
rm t/t &&