From 02249587f9383e43786fb730187d0a743c7cb8e3 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Thu, 9 Mar 2023 12:33:02 -0700 Subject: [PATCH] don't show orphaned branches in the ref list --- git/git.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git/git.go b/git/git.go index fb2cc51..306e829 100644 --- a/git/git.go +++ b/git/git.go @@ -110,6 +110,10 @@ func (g *GitRepo) Tags() ([]*object.Tag, error) { tags := []*object.Tag{} _ = ti.ForEach(func(t *object.Tag) error { + refName := plumbing.NewTagReferenceName(t.Name) + if _, unreachable := g.r.Reference(refName, true); unreachable != nil { + return nil + } for i, existing := range tags { if existing.Name == t.Name { if t.Tagger.When.After(existing.Tagger.When) {