Open easonyq opened 5 years ago
I found the following way to get commit message of lightweight tags.
tagrefs, _ := repo.Tags()
tagrefs.ForEach(func(t *plumbing.Reference) error {
h, err := repo.ResolveRevision(plumbing.Revision(t.Hash().String()))
checkError(err)
if h == nil {
fmt.Println("empty return")
return nil
}
obj, err := repo.Object(plumbing.AnyObject, *h)
checkError(err)
o := obj.(*object.Commit)
fmt.Println(o.Message)
return nil
})
I've know that go-git supported creating an annotated tag from issue#430.
But I couldnot find a way to get:
Commit message of a lightweight tag(I found a way and listed it below. If there is any better ways please let me know)What I've tried:
Actually,
git cat-file -t <tagname>
andgit tag -n
is somewhat similar to what I need.Thanks for your replying.