From edd37bb4fd3aa08eda39303fd5628a554a8c3aeb Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 16 Nov 2025 00:00:00 +0000 Subject: Separate stored object types from types that the user is expected to construct. --- obj_tag.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'obj_tag.go') 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 -- cgit v1.3.1-10-gc9f91