diff options
| author | 2025-11-16 00:00:00 +0000 | |
|---|---|---|
| committer | 2025-11-16 00:00:00 +0000 | |
| commit | bd91bf5f3bcffe5d1023ab9a37e4a9425830aba9 (patch) | |
| tree | e6e9fb33bfa5c455a824f0af065c54529d357c0c /obj_tag.go | |
| parent | Revert "hash: Generic hash-algorithm API" (diff) | |
| signature | ||
hash: Make fewer helper functions need explicit hash length fields
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 } |
