diff options
| author | 2026-06-08 07:07:09 +0000 | |
|---|---|---|
| committer | 2026-06-08 07:07:09 +0000 | |
| commit | 7c3eaa3ddfc19b5334634faa50b4570433402b19 (patch) | |
| tree | e591d31976f99b72295d259737c428b1525896b2 /object/fetch | |
| parent | object/fetch: Port tree (diff) | |
object/fetch: Port tag
Diffstat (limited to 'object/fetch')
| -rw-r--r-- | object/fetch/tag.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/object/fetch/tag.go b/object/fetch/tag.go new file mode 100644 index 00000000..422b818d --- /dev/null +++ b/object/fetch/tag.go @@ -0,0 +1,26 @@ +package fetch + +import ( + giterrors "lindenii.org/go/furgit/errors" + oid "lindenii.org/go/furgit/object/id" + "lindenii.org/go/furgit/object/stored" + "lindenii.org/go/furgit/object/tag" + "lindenii.org/go/furgit/object/typ" +) + +// ExactTag reads, parses, and wraps the tag at id. +// +// Labels: Life-Parent. +func (r *Fetcher) ExactTag(id oid.ObjectID) (*stored.Stored[*tag.Tag], error) { + parsed, err := r.parseObject(id) + if err != nil { + return nil, err + } + + tag, ok := parsed.(*tag.Tag) + if !ok { + return nil, &giterrors.ObjectTypeError{OID: id, Got: parsed.ObjectType(), Want: typ.TypeTag} + } + + return stored.New(id, tag), nil +} |
