don't show orphaned branches in the ref list

This commit is contained in:
Iris Lightshard 2023-03-09 12:33:02 -07:00
parent 94d07ef8b2
commit 02249587f9
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398

View file

@ -110,6 +110,10 @@ func (g *GitRepo) Tags() ([]*object.Tag, error) {
tags := []*object.Tag{} tags := []*object.Tag{}
_ = ti.ForEach(func(t *object.Tag) error { _ = 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 { for i, existing := range tags {
if existing.Name == t.Name { if existing.Name == t.Name {
if t.Tagger.When.After(existing.Tagger.When) { if t.Tagger.When.After(existing.Tagger.When) {