git-module

git clone git://git.lin.moe/fork/git-module.git

 1package git
 2
 3import "context"
 4
 5// Tag contains information of a Git tag.
 6type Tag struct {
 7	typ      ObjectType
 8	id       Oid
 9	commitID Oid // The ID of the underlying commit
10	refspec  string
11	tagger   *Signature
12	message  string
13
14	repo *Repository
15}
16
17// Type returns the type of the tag.
18func (t *Tag) Type() ObjectType {
19	return t.typ
20}
21
22// ID returns the SHA-1 hash of the tag.
23func (t *Tag) ID() Oid {
24	return t.id
25}
26
27// CommitID returns the commit ID of the tag.
28func (t *Tag) CommitID() Oid {
29	return t.commitID
30}
31
32// Refspec returns the refspec of the tag.
33func (t *Tag) Refspec() string {
34	return t.refspec
35}
36
37// Tagger returns the tagger of the tag.
38func (t *Tag) Tagger() *Signature {
39	return t.tagger
40}
41
42// Message returns the message of the tag.
43func (t *Tag) Message() string {
44	return t.message
45}
46
47// Commit returns the underlying commit of the tag.
48func (t *Tag) Commit(ctx context.Context, opts ...CatFileCommitOptions) (*Commit, error) {
49	return t.repo.CatFileCommit(ctx, t.commitID.String(), opts...)
50}