3 test_description='test for-each-refs usage of ref-filter APIs'
6 . "$TEST_DIRECTORY"/lib-gpg.sh
8 if ! test_have_prereq GPG
10 skip_all="skipping for-each-ref tests, GPG not available"
14 test_expect_success 'setup some history and refs' '
18 git checkout -b side &&
20 git tag -s -m "A signed tag message" signed-tag &&
21 git tag -s -m "Annonated doubly" double-tag signed-tag &&
22 git checkout master &&
23 git update-ref refs/odd/spot master
26 test_expect_success 'filtering with --points-at' '
27 cat >expect <<-\EOF &&
32 git for-each-ref --format="%(refname)" --points-at=master >actual &&
33 test_cmp expect actual
36 test_expect_success 'check signed tags with --points-at' '
37 sed -e "s/Z$//" >expect <<-\EOF &&
40 refs/tags/signed-tag four
42 git for-each-ref --format="%(refname) %(*subject)" --points-at=side >actual &&
43 test_cmp expect actual
46 test_expect_success 'filtering with --merged' '
47 cat >expect <<-\EOF &&
54 git for-each-ref --format="%(refname)" --merged=master >actual &&
55 test_cmp expect actual
58 test_expect_success 'filtering with --no-merged' '
59 cat >expect <<-\EOF &&
65 git for-each-ref --format="%(refname)" --no-merged=master >actual &&
66 test_cmp expect actual
69 test_expect_success 'filtering with --contains' '
70 cat >expect <<-\EOF &&
80 git for-each-ref --format="%(refname)" --contains=two >actual &&
81 test_cmp expect actual