diff options
| author | 2025-11-16 00:00:00 +0000 | |
|---|---|---|
| committer | 2025-11-16 00:00:00 +0000 | |
| commit | edd37bb4fd3aa08eda39303fd5628a554a8c3aeb (patch) | |
| tree | 9b438c2e0b64f880cc57c90446fcec8768e7730b /obj.go | |
| parent | Move config to its own package (diff) | |
| signature | ||
Separate stored object types from types that the user is expected to construct.
Diffstat (limited to 'obj.go')
| -rw-r--r-- | obj.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -33,6 +33,12 @@ type Object interface { ObjectType() ObjectType } +// StoredObject describes a Git object with a known hash. +type StoredObject interface { + Object + Hash() Hash +} + func headerForType(ty ObjectType, body []byte) ([]byte, error) { var tyStr string switch ty { @@ -59,7 +65,7 @@ func headerForType(ty ObjectType, body []byte) ([]byte, error) { return buf.Bytes(), nil } -func parseObjectBody(ty ObjectType, id Hash, body []byte, repo *Repository) (Object, error) { +func parseObjectBody(ty ObjectType, id Hash, body []byte, repo *Repository) (StoredObject, error) { switch ty { case ObjectTypeBlob: return parseBlob(id, body) |
