summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Karthik Nayak <karthik.188@gmail.com>2015-07-07 21:36:10 +0530
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-03 10:25:28 -0700
commitd325406ef2f3c819d02ac838fb2a3f8e021d08ae (patch)
tree224d02444d6b885aaa809ed488a217d24060052c /t
parentref-filter: implement '--points-at' option (diff)
downloadtgif-d325406ef2f3c819d02ac838fb2a3f8e021d08ae.tar.xz
for-each-ref: add '--points-at' option
Add the '--points-at' option provided by 'ref-filter'. The option lets the user to list only refs which points at the given object. Add documentation and tests for the same. Based-on-patch-by: Jeff King <peff@peff.net> Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t6302-for-each-ref-filter.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
index ae751163f7..98ff4d5e43 100755
--- a/t/t6302-for-each-ref-filter.sh
+++ b/t/t6302-for-each-ref-filter.sh
@@ -23,4 +23,24 @@ 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_done