Skip to content

Commit c960939

Browse files
avargitster
authored andcommitted
pickaxe tests: add test for diffgrep_consume() internals
In diffgrep_consume() we generate a diff, and then advance past the "+" or "-" at the start of the line for matching. This has been done ever since the code was added in f506b8e (git log/diff: add -G<regexp> that greps in the patch text, 2010-08-23). If we match "line" instead of "line + 1" no tests fail, i.e. we've got zero coverage for whether any of our searches match the beginning of the line or not. Let's add a test for this. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6d0a401 commit c960939

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t4209-log-pickaxe.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,21 @@ test_expect_success 'log -S --no-textconv (missing textconv tool)' '
106106
rm .gitattributes
107107
'
108108

109+
test_expect_success 'setup log -[GS] plain' '
110+
test_create_repo GS-plain &&
111+
test_commit -C GS-plain --append A data.txt "a" &&
112+
test_commit -C GS-plain --append B data.txt "a a" &&
113+
test_commit -C GS-plain C data.txt "" &&
114+
git -C GS-plain log >full-log
115+
'
116+
117+
test_expect_success 'log -G trims diff new/old [-+]' '
118+
git -C GS-plain log -G"[+-]a" >log &&
119+
test_must_be_empty log &&
120+
git -C GS-plain log -G"^a" >log &&
121+
test_cmp log full-log
122+
'
123+
109124
test_expect_success 'setup log -[GS] binary & --text' '
110125
test_create_repo GS-bin-txt &&
111126
test_commit -C GS-bin-txt --printf A data.bin "a\na\0a\n" &&

0 commit comments

Comments
 (0)