path: root/t/
diff options
authorDenton Liu <>2019-04-04 18:25:15 (GMT)
committerJunio C Hamano <>2019-04-12 01:52:35 (GMT)
commiteea9c1e78ffd878cbaaf2c1e346e186a1e58a460 (patch)
treeec87c56eb606225be5ccfb62d0982f591a521a09 /t/
parent01dc801adad35d4e2f815dc1918dad057631bc0e (diff)
tag: advise on nested tags
Robert Dailey reported confusion on the mailing list about a nested tag which was most likely created by mistake. Jeff King noted that this isn't a very common case and creating a tag-to-a-tag can be a user-error. Suggest that it may be a mistake with an advice message when creating such a tag. Those who do want to create a tag that point at another tag regularly can turn it off with the usual advice mechanism. Reported-by: Robert Dailey <> Helped-by: Jeff King <> Helped-by: Ævar Arnfjörð Bjarmason <> Signed-off-by: Denton Liu <> [jc: fixed test style and tweaked the log message] Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 11 insertions, 0 deletions
diff --git a/t/ b/t/
index 0b01862..e285686 100755
--- a/t/
+++ b/t/
@@ -1700,6 +1700,17 @@ test_expect_success '--points-at finds annotated tags of tags' '
test_cmp expect actual
+test_expect_success 'recursive tagging should give advice' '
+ sed -e "s/|$//" <<-EOF >expect &&
+ hint: You have created a nested tag. The object referred to by your new is
+ hint: already a tag. If you meant to tag the object that it points to, use:
+ hint: |
+ hint: git tag -f nested annotated-v4.0^{}
+ git tag -m nested nested annotated-v4.0 2>actual &&
+ test_i18ncmp expect actual
test_expect_success 'multiple --points-at are OR-ed together' '
cat >expect <<-\EOF &&