t3201: test multiple branch filter combinations
Add tests covering the behavior of passing multiple contains/no-contains filters to git branch, e.g.: $ git branch --contains feature_a --contains feature_b $ git branch --no-contains feature_a --no-contains feature_b When passed more than one contains (or no-contains) filter, the tips of the branches returned must be reachable from any of the contains commits and from none of the the no-contains commits. This logic is useful to describe prior to enabling multiple merged/no-merged filters, so that future tests will demonstrate consistent behavior between merged/no-merged and contains/no-contains filters. Signed-off-by: Aaron Lipman <alipman88@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Aaron Lipman committed
Sep 15, 2020 at 22:08 UTC
b775d8122ecec94a99c1a6588a38455cdd41d8e2
1 file changed
+36
-11
t/t3201-branch-contains.sh
+36
-11
@@ -171,6 +171,42 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
171
test_must_fail git branch --no-contains $blob
172
'
173
174
+test_expect_success 'multiple branch --contains' '
175
+ git checkout -b side2 master &&
176
+ >feature &&
177
+ git add feature &&
178
+ git commit -m "add feature" &&
179
+ git checkout -b next master &&
180
+ git merge side &&
181
+ git branch --contains side --contains side2 >actual &&
182
+ cat >expect <<-\EOF &&
183
+ * next
184
+ side
185
+ side2
186
+ EOF
187
+ test_cmp expect actual
188
+'
189
+
190
+test_expect_success 'multiple branch --no-contains' '
191
+ git branch --no-contains side --no-contains side2 >actual &&
192
+ cat >expect <<-\EOF &&
193
+ master
194
+ EOF
195
+ test_cmp expect actual
196
+'
197
+
198
+test_expect_success 'branch --contains combined with --no-contains' '
199
+ git checkout -b seen master &&
200
+ git merge side &&
201
+ git merge side2 &&
202
+ git branch --contains side --no-contains side2 >actual &&
203
+ cat >expect <<-\EOF &&
204
+ next
205
+ side
206
+ EOF
207
+ test_cmp expect actual
208
+'
209
+
210
# We want to set up a case where the walk for the tracking info
211
# of one branch crosses the tip of another branch (and make sure
212
# that the latter walk does not mess up our flag to see if it was
@@ -200,15 +236,4 @@ test_expect_success 'branch --merged with --verbose' '
236
test_i18ncmp expect actual
237
'
238
203
-test_expect_success 'branch --contains combined with --no-contains' '
204
- git branch --contains zzz --no-contains topic >actual &&
205
- cat >expect <<-\EOF &&
206
- master
207
- side
208
- zzz
209
- EOF
210
- test_cmp expect actual
211
-
212
-'
213
-
239
test_done