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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Apr 12, 2021 at 19:15 UTC
69ae93089cd892d70429f7f06371860d65cb1f1b
1 file changed
+27
-3
t/t4209-log-pickaxe.sh
+27
-3
@@ -106,11 +106,18 @@ test_expect_success 'log -S --no-textconv (missing textconv tool)' '
106
rm .gitattributes
107
'
108
109
-test_expect_success 'setup log -[GS] plain' '
109
+test_expect_success 'setup log -[GS] plain & regex' '
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 "" &&
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 &&
121
git -C GS-plain log >full-log
122
'
123
@@ -118,7 +125,24 @@ test_expect_success 'log -G trims diff new/old [-+]' '
125
git -C GS-plain log -G"[+-]a" >log &&
126
test_must_be_empty log &&
127
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
146
'
147
148
test_expect_success 'setup log -[GS] binary & --text' '