Skip to content

Commit ff37a60

Browse files
avargitster
authored andcommitted
log tests: check if grep_config() is called by "log"-like cmds
Extend the tests added in my 9df4676 (log: add exhaustive tests for pattern style options & config, 2017-05-20) to check not only whether "git log" handles "grep.patternType", but also "git show" etc. It's sufficient to check whether we match a "fixed" or a "basic" regex here to see if these codepaths correctly invoked grep_config(). We don't need to check the details of their regular expression matching as the "log" test does. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 77e3f93 commit ff37a60

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t4202-log.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,30 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati
449449
)
450450
'
451451

452+
for cmd in show whatchanged reflog format-patch
453+
do
454+
case "$cmd" in
455+
format-patch) myarg="HEAD~.." ;;
456+
*) myarg= ;;
457+
esac
458+
459+
test_expect_success "$cmd: understands grep.patternType, like 'log'" '
460+
git init "pattern-type-$cmd" &&
461+
(
462+
cd "pattern-type-$cmd" &&
463+
test_commit 1 file A &&
464+
test_commit "(1|2)" file B 2 &&
465+
466+
git -c grep.patternType=fixed $cmd --grep="..." $myarg >actual &&
467+
test_must_be_empty actual &&
468+
469+
git -c grep.patternType=basic $cmd --grep="..." $myarg >actual &&
470+
test_file_not_empty actual
471+
)
472+
'
473+
done
474+
test_done
475+
452476
test_expect_success 'log --author' '
453477
cat >expect <<-\EOF &&
454478
Author: <BOLD;RED>A U<RESET> Thor <[email protected]>

0 commit comments

Comments
 (0)