diff options
| author | 2025-11-16 00:00:00 +0000 | |
|---|---|---|
| committer | 2025-11-16 00:00:00 +0000 | |
| commit | edd37bb4fd3aa08eda39303fd5628a554a8c3aeb (patch) | |
| tree | 9b438c2e0b64f880cc57c90446fcec8768e7730b /obj_tag.go | |
| parent | Move config to its own package (diff) | |
| signature | ||
Separate stored object types from types that the user is expected to construct.
Diffstat (limited to 'obj_tag.go')
| -rw-r--r-- | obj_tag.go | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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 |
