diff options
Diffstat (limited to 'obj_tag.go')
| -rw-r--r-- | obj_tag.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -22,7 +22,7 @@ func (*Tag) ObjType() ObjType { } // parseTag parses a tag object body. -func parseTag(id Hash, body []byte, hashSize int) (*Tag, error) { +func parseTag(id Hash, body []byte, repo *Repository) (*Tag, error) { t := new(Tag) t.Hash = id i := 0 @@ -41,7 +41,7 @@ func parseTag(id Hash, body []byte, hashSize int) (*Tag, error) { switch { case bytes.HasPrefix(line, []byte("object ")): - hash, err := ParseHashWithSize(string(line[7:]), hashSize) + hash, err := repo.ParseHash(string(line[7:])) if err != nil { return nil, fmt.Errorf("furgit: tag: object: %w", err) } @@ -94,9 +94,9 @@ func parseTag(id Hash, body []byte, hashSize int) (*Tag, error) { return t, nil } -func tagBody(t *Tag, hashSize int) ([]byte, error) { +func tagBody(t *Tag) ([]byte, error) { var buf bytes.Buffer - fmt.Fprintf(&buf, "object %s\n", t.Target.StringWithSize(hashSize)) + fmt.Fprintf(&buf, "object %s\n", t.Target.String()) buf.WriteString("type ") switch t.TargetType { case ObjCommit: @@ -128,8 +128,8 @@ func tagBody(t *Tag, hashSize int) ([]byte, error) { } // Serialize renders a Tag into canonical Git format. -func (t *Tag) Serialize(hashSize int) ([]byte, error) { - body, err := tagBody(t, hashSize) +func (t *Tag) Serialize() ([]byte, error) { + body, err := tagBody(t) if err != nil { return nil, err } |
