-
Notifications
You must be signed in to change notification settings - Fork 128
/
tag.go
52 lines (42 loc) · 1.12 KB
/
tag.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2015 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package git
// Tag contains information of a Git tag.
type Tag struct {
typ ObjectType
id *SHA1
commitID *SHA1 // The ID of the underlying commit
refspec string
tagger *Signature
message string
repo *Repository
}
// Type returns the type of the tag.
func (t *Tag) Type() ObjectType {
return t.typ
}
// ID returns the SHA-1 hash of the tag.
func (t *Tag) ID() *SHA1 {
return t.id
}
// CommitID returns the commit ID of the tag.
func (t *Tag) CommitID() *SHA1 {
return t.commitID
}
// Refspec returns the refspec of the tag.
func (t *Tag) Refspec() string {
return t.refspec
}
// Tagger returns the tagger of the tag.
func (t *Tag) Tagger() *Signature {
return t.tagger
}
// Message returns the message of the tag.
func (t *Tag) Message() string {
return t.message
}
// Commit returns the underlying commit of the tag.
func (t *Tag) Commit(opts ...CatFileCommitOptions) (*Commit, error) {
return t.repo.CatFileCommit(t.commitID.String(), opts...)
}