aboutsummaryrefslogtreecommitdiff
path: root/obj_tag.go
diff options
context:
space:
mode:
Diffstat (limited to 'obj_tag.go')
-rw-r--r--obj_tag.go20
1 files changed, 15 insertions, 5 deletions
diff --git a/obj_tag.go b/obj_tag.go
index 20088f17..2157e251 100644
--- a/obj_tag.go
+++ b/obj_tag.go
@@ -6,9 +6,8 @@ import (
"fmt"
)
-// Tag models an annotated Git tag object.
+// Tag represents an annotated Git tag object.
type Tag struct {
- Hash Hash
Target Hash
TargetType ObjectType
Name []byte
@@ -16,6 +15,17 @@ type Tag struct {
Message []byte
}
+// StoredTag represents a tag stored in the object database.
+type StoredTag struct {
+ Tag
+ hash Hash
+}
+
+// Hash returns the hash of the stored tag.
+func (sTag *StoredTag) Hash() Hash {
+ return sTag.hash
+}
+
// ObjectType allows Tag to satisfy the Object interface.
func (tag *Tag) ObjectType() ObjectType {
_ = tag
@@ -23,9 +33,9 @@ func (tag *Tag) ObjectType() ObjectType {
}
// parseTag parses a tag object body.
-func parseTag(id Hash, body []byte, repo *Repository) (*Tag, error) {
- t := new(Tag)
- t.Hash = id
+func parseTag(id Hash, body []byte, repo *Repository) (*StoredTag, error) {
+ t := new(StoredTag)
+ t.hash = id
i := 0
var haveTarget, haveType bool