From a964e32d92c53a47ce7c46d589a18c62133b8c50 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Wed, 17 Feb 2016 00:24:31 +0100 Subject: storages: memory object --- objects.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'objects.go') diff --git a/objects.go b/objects.go index 9397bc8..cf2c1ff 100644 --- a/objects.go +++ b/objects.go @@ -1,6 +1,7 @@ package git import ( + "errors" "fmt" "io" "strconv" @@ -17,8 +18,14 @@ type Blob struct { obj core.Object } +var ErrUnsupportedObject = errors.New("unsupported object type") + // Decode transform an core.Object into a Blob struct func (b *Blob) Decode(o core.Object) error { + if o.Type() != core.BlobObject { + return ErrUnsupportedObject + } + b.Hash = o.Hash() b.Size = o.Size() b.obj = o -- cgit