I'm trying to get the tree of files from a git tag and everything worked just fine until I found out some tags are not annotated and hence not a TagObject
This is my current code:
var obj *plumbing.Reference
obj, err = r.Tag(tag)
checkError(err)
var t *object.Tag
t, err = r.TagObject(obj.Hash())
checkError(err)
var tree *object.Tree
tree, err = t.Tree()
checkError(err)
but now that I had to change it to the following to have access to lightweight tags too
var obj *plumbing.Reference
obj, err = r.Tag(tag)
checkError(err)
var t *plumbing.Reference
t, err = r.Tag(obj.Name().String())
checkError(err)
var tree *object.Tree
tree, err = t.Tree()
checkError(err)
the third part (tree, err = t.Tree()) doesn't work anymore of course, because *plumbing.Reference has no field or method Tree
Is there any way to go from
t, err = r.Tag(obj.Name().String())
to getting a tree?