Skip to content

Commit 69ae930

Browse files
avargitster
authored andcommitted
pickaxe tests: add test for "log -S" not being a regex
No test in our test suite checked for "log -S<pat>" being a fixed string, as opposed to "log -S<pat> --pickaxe-regex". Let's test for it. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c960939 commit 69ae930

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

t/t4209-log-pickaxe.sh

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

109-
test_expect_success 'setup log -[GS] plain' '
109+
test_expect_success 'setup log -[GS] plain & regex' '
110110
test_create_repo GS-plain &&
111111
test_commit -C GS-plain --append A data.txt "a" &&
112112
test_commit -C GS-plain --append B data.txt "a a" &&
113-
test_commit -C GS-plain C data.txt "" &&
113+
test_commit -C GS-plain --append C data.txt "b" &&
114+
test_commit -C GS-plain --append D data.txt "[b]" &&
115+
test_commit -C GS-plain E data.txt "" &&
116+
117+
# We also include E, the deletion commit
118+
git -C GS-plain log --grep="[ABE]" >A-to-B-then-E-log &&
119+
git -C GS-plain log --grep="[CDE]" >C-to-D-then-E-log &&
120+
git -C GS-plain log --grep="[DE]" >D-then-E-log &&
114121
git -C GS-plain log >full-log
115122
'
116123

117124
test_expect_success 'log -G trims diff new/old [-+]' '
118125
git -C GS-plain log -G"[+-]a" >log &&
119126
test_must_be_empty log &&
120127
git -C GS-plain log -G"^a" >log &&
121-
test_cmp log full-log
128+
test_cmp log A-to-B-then-E-log
129+
'
130+
131+
test_expect_success 'log -S<pat> is not a regex, but -S<pat> --pickaxe-regex is' '
132+
git -C GS-plain log -S"a" >log &&
133+
test_cmp log A-to-B-then-E-log &&
134+
135+
git -C GS-plain log -S"[a]" >log &&
136+
test_must_be_empty log &&
137+
138+
git -C GS-plain log -S"[a]" --pickaxe-regex >log &&
139+
test_cmp log A-to-B-then-E-log &&
140+
141+
git -C GS-plain log -S"[b]" >log &&
142+
test_cmp log D-then-E-log &&
143+
144+
git -C GS-plain log -S"[b]" --pickaxe-regex >log &&
145+
test_cmp log C-to-D-then-E-log
122146
'
123147

124148
test_expect_success 'setup log -[GS] binary & --text' '

0 commit comments

Comments
 (0)