aboutsummaryrefslogtreecommitdiff
path: root/obj.go
diff options
context:
space:
mode:
Diffstat (limited to 'obj.go')
-rw-r--r--obj.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/obj.go b/obj.go
index de847607..ee11a024 100644
--- a/obj.go
+++ b/obj.go
@@ -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)