Merge branch 'jc/rerere'
[gitweb.git] / t / t6302-for-each-ref-filter.sh
index ae751163f79e3a0191154cfc0e66e278dc525b03..505a3601610be4a18a74cd427b0ae11866aa70c6 100755 (executable)
@@ -23,4 +23,62 @@ test_expect_success 'setup some history and refs' '
        git update-ref refs/odd/spot master
 '
 
+test_expect_success 'filtering with --points-at' '
+       cat >expect <<-\EOF &&
+       refs/heads/master
+       refs/odd/spot
+       refs/tags/three
+       EOF
+       git for-each-ref --format="%(refname)" --points-at=master >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'check signed tags with --points-at' '
+       sed -e "s/Z$//" >expect <<-\EOF &&
+       refs/heads/side Z
+       refs/tags/four Z
+       refs/tags/signed-tag four
+       EOF
+       git for-each-ref --format="%(refname) %(*subject)" --points-at=side >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'filtering with --merged' '
+       cat >expect <<-\EOF &&
+       refs/heads/master
+       refs/odd/spot
+       refs/tags/one
+       refs/tags/three
+       refs/tags/two
+       EOF
+       git for-each-ref --format="%(refname)" --merged=master >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'filtering with --no-merged' '
+       cat >expect <<-\EOF &&
+       refs/heads/side
+       refs/tags/double-tag
+       refs/tags/four
+       refs/tags/signed-tag
+       EOF
+       git for-each-ref --format="%(refname)" --no-merged=master >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'filtering with --contains' '
+       cat >expect <<-\EOF &&
+       refs/heads/master
+       refs/heads/side
+       refs/odd/spot
+       refs/tags/double-tag
+       refs/tags/four
+       refs/tags/signed-tag
+       refs/tags/three
+       refs/tags/two
+       EOF
+       git for-each-ref --format="%(refname)" --contains=two >actual &&
+       test_cmp expect actual
+'
+
 test_done