]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3201-branch-contains.sh
t3201: test multiple branch filter combinations
[thirdparty/git.git] / t / t3201-branch-contains.sh
index 40251c9f8f68cbfba145976eb912ecdd3364dc65..3cb9dc6cca53faacc6b00d8f09206c32d421963f 100755 (executable)
@@ -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