Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Lipman <alipman88@gmail.com>2020-09-16 05:08:38 +0300
committerJunio C Hamano <gitster@pobox.com>2020-09-16 22:38:09 +0300
commitb775d8122ecec94a99c1a6588a38455cdd41d8e2 (patch)
tree00745e177be38864825967528bf654226a1c0e70 /t/t3201-branch-contains.sh
parent54e85e7af1ac9e9a92888060d6811ae767fea1bc (diff)
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>
Diffstat (limited to 't/t3201-branch-contains.sh')
-rwxr-xr-xt/t3201-branch-contains.sh47
1 files changed, 36 insertions, 11 deletions
diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh
index 40251c9f8f..3cb9dc6cca 100755
--- a/t/t3201-branch-contains.sh
+++ b/t/t3201-branch-contains.sh
@@ -171,6 +171,42 @@ test_expect_success 'Assert that --contains only works on commits, not trees & b
test_must_fail git branch --no-contains $blob
'
+test_expect_success 'multiple branch --contains' '
+ git checkout -b side2 master &&
+ >feature &&
+ git add feature &&
+ git commit -m "add feature" &&
+ git checkout -b next master &&
+ git merge side &&
+ git branch --contains side --contains side2 >actual &&
+ cat >expect <<-\EOF &&
+ * next
+ side
+ side2
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'multiple branch --no-contains' '
+ git branch --no-contains side --no-contains side2 >actual &&
+ cat >expect <<-\EOF &&
+ master
+ EOF
+ test_cmp expect actual
+'
+
+test_expect_success 'branch --contains combined with --no-contains' '
+ git checkout -b seen master &&
+ git merge side &&
+ git merge side2 &&
+ git branch --contains side --no-contains side2 >actual &&
+ cat >expect <<-\EOF &&
+ next
+ side
+ EOF
+ test_cmp expect actual
+'
+
# We want to set up a case where the walk for the tracking info
# of one branch crosses the tip of another branch (and make sure
# 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' '
test_i18ncmp expect actual
'
-test_expect_success 'branch --contains combined with --no-contains' '
- git branch --contains zzz --no-contains topic >actual &&
- cat >expect <<-\EOF &&
- master
- side
- zzz
- EOF
- test_cmp expect actual
-
-'
-
test_done