From 21b87300cc821983a1ac5573c7d2931be8ee9267 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Mon, 15 Dec 2025 13:51:26 +0000 Subject: [PATCH] Fix the commit annotation tags. --- cmd/utils/git.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/utils/git.go b/cmd/utils/git.go index 807019c..190dd4d 100644 --- a/cmd/utils/git.go +++ b/cmd/utils/git.go @@ -179,14 +179,25 @@ func ListExistingTags(repo *GitRepository) { } if err := refs.ForEach(func(ref *plumbing.Reference) error { + tagName := ref.Name().Short() + commitHash := ref.Hash().String() + + // For annotated tags, dereference to get the actual commit hash + tagObj, err := repo.Handler.TagObject(ref.Hash()) + if err == nil { + // This is an annotated tag - get the commit it points to + commitHash = tagObj.Target.String() + } + // If err != nil, it's a lightweight tag - ref.Hash() is already the commit hash + repo.Tags = append(repo.Tags, TagDetails{ - Name: ref.Name().Short(), - Hash: ref.Hash().String(), + Name: tagName, + Hash: commitHash, }) Debug("Found tag", map[string]interface{}{ - "tag": ref.Name().Short(), - "hash": ref.Hash().String(), + "tag": tagName, + "hash": commitHash, }) return nil