aboutsummaryrefslogtreecommitdiffstats
path: root/objects.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-02-17 00:24:31 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2016-02-17 11:46:00 +0100
commita964e32d92c53a47ce7c46d589a18c62133b8c50 (patch)
tree4c094cd6afb95cb2832f866b9411276418435819 /objects.go
parent1ac00554c3b5f88d2ddc2e28e7cfcdcad9d9f4bb (diff)
downloadgo-git-a964e32d92c53a47ce7c46d589a18c62133b8c50.tar.gz
storages: memory object
Diffstat (limited to 'objects.go')
-rw-r--r--objects.go7
1 files changed, 7 insertions, 0 deletions
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