diff options
| author | 2026-02-20 22:30:57 +0800 | |
|---|---|---|
| committer | 2026-02-20 22:30:57 +0800 | |
| commit | bb5b5334c74026c0a46f48cf2418038e0d909e9b (patch) | |
| tree | a5520e55b904a1f973898858e2278f0be294a34b /object/commit_serialize.go | |
| parent | object: Use objectheader (diff) | |
| signature | No signature | |
object: Remove the old opaque errors
Diffstat (limited to 'object/commit_serialize.go')
| -rw-r--r-- | object/commit_serialize.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/object/commit_serialize.go b/object/commit_serialize.go index b7c058a3..c34c44a3 100644 --- a/object/commit_serialize.go +++ b/object/commit_serialize.go @@ -2,6 +2,7 @@ package object import ( "bytes" + "errors" "fmt" "codeberg.org/lindenii/furgit/internal/objectheader" @@ -13,7 +14,7 @@ func (commit *Commit) SerializeWithoutHeader() ([]byte, error) { var buf bytes.Buffer if commit.Tree.Size() == 0 { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: missing tree id") } fmt.Fprintf(&buf, "tree %s\n", commit.Tree.String()) for _, parent := range commit.Parents { @@ -43,7 +44,7 @@ func (commit *Commit) SerializeWithoutHeader() ([]byte, error) { } for _, h := range commit.ExtraHeaders { if h.Key == "" { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: extra header has empty key") } buf.WriteString(h.Key) buf.WriteByte(' ') @@ -64,7 +65,7 @@ func (commit *Commit) SerializeWithHeader() ([]byte, error) { } header, ok := objectheader.Encode(objecttype.TypeCommit, int64(len(body))) if !ok { - return nil, ErrInvalidObject + return nil, errors.New("object: commit: failed to encode object header") } raw := make([]byte, len(header)+len(body)) copy(raw, header) |
