summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Tom Grennan <tmgrennan@gmail.com>2012-02-08 15:03:43 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-02-08 19:59:41 -0800
commitae7706b9ac98e3c412d799c910de604347ffce5d (patch)
tree849466f3fb04b57a2701081bc60c2b807a693005 /t
parentGit 1.7.9 (diff)
downloadtgif-ae7706b9ac98e3c412d799c910de604347ffce5d.tar.xz
tag: add --points-at list option
This filters the list for tags of the given object. Example, john$ git tag v1.0-john v1.0 john$ git tag -l --points-at v1.0 v1.0-john v1.0 Signed-off-by: Tom Grennan <tmgrennan@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t7004-tag.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index e93ac73829..f61e3987ee 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1269,4 +1269,43 @@ test_expect_success 'mixing incompatibles modes and options is forbidden' '
test_must_fail git tag -v -s
'
+# check points-at
+
+test_expect_success '--points-at cannot be used in non-list mode' '
+ test_must_fail git tag --points-at=v4.0 foo
+'
+
+test_expect_success '--points-at finds lightweight tags' '
+ echo v4.0 >expect &&
+ git tag --points-at v4.0 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--points-at finds annotated tags of commits' '
+ git tag -m "v4.0, annotated" annotated-v4.0 v4.0 &&
+ echo annotated-v4.0 >expect &&
+ git tag -l --points-at v4.0 "annotated*" >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '--points-at finds annotated tags of tags' '
+ git tag -m "describing the v4.0 tag object" \
+ annotated-again-v4.0 annotated-v4.0 &&
+ cat >expect <<-\EOF &&
+ annotated-again-v4.0
+ annotated-v4.0
+ EOF
+ git tag --points-at=annotated-v4.0 >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'multiple --points-at are OR-ed together' '
+ cat >expect <<-\EOF &&
+ v2.0
+ v3.0
+ EOF
+ git tag --points-at=v2.0 --points-at=v3.0 >actual &&
+ test_cmp expect actual
+'
+
test_done