ref-filter: add --no-contains option to tag/branch/for-each-ref
[gitweb.git] / t / t6302-for-each-ref-filter.sh
index fed30133d4984c2c292807302a182422aa27305d..fc067ed6723bc0aaaddd2473e4d61f13087b9e15 100755 (executable)
@@ -93,6 +93,22 @@ test_expect_success 'filtering with --contains' '
        test_cmp expect actual
 '
 
+test_expect_success 'filtering with --no-contains' '
+       cat >expect <<-\EOF &&
+       refs/tags/one
+       EOF
+       git for-each-ref --format="%(refname)" --no-contains=two >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'filtering with --contains and --no-contains' '
+       cat >expect <<-\EOF &&
+       refs/tags/two
+       EOF
+       git for-each-ref --format="%(refname)" --contains=two --no-contains=three >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success '%(color) must fail' '
        test_must_fail git for-each-ref --format="%(color)%(refname)"
 '
@@ -403,4 +419,26 @@ test_expect_success 'ignore spaces in %(if) atom usage' '
        test_cmp expect actual
 '
 
+test_expect_success 'check %(if:equals=<string>)' '
+       git for-each-ref --format="%(if:equals=master)%(refname:short)%(then)Found master%(else)Not master%(end)" refs/heads/ >actual &&
+       cat >expect <<-\EOF &&
+       Found master
+       Not master
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'check %(if:notequals=<string>)' '
+       git for-each-ref --format="%(if:notequals=master)%(refname:short)%(then)Not master%(else)Found master%(end)" refs/heads/ >actual &&
+       cat >expect <<-\EOF &&
+       Found master
+       Not master
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success '--merged is incompatible with --no-merged' '
+       test_must_fail git for-each-ref --merged HEAD --no-merged HEAD
+'
+
 test_done