aboutsummaryrefslogtreecommitdiffstats
path: root/tree.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-08-29 22:47:13 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-29 22:47:13 +0200
commite4246138cb9ffb819c052ba17a9fbdf915427291 (patch)
treebd938368afe0ffd7c9e1df16256e39e17d8184b5 /tree.go
parentdd4af03ad368cc50dd08912010f5b667bd7569cd (diff)
downloadgo-git-e4246138cb9ffb819c052ba17a9fbdf915427291.tar.gz
storage: Add object type hint parameter to ObjectStorage.Get. (#69)
Some storage backends can optimize object lookup if they get the object type that is expected. So we the signature of the Get method is now Get(Hash, ObjectType). Added generic tests for storage backends.
Diffstat (limited to 'tree.go')
-rw-r--r--tree.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/tree.go b/tree.go
index 3058231..de9765b 100644
--- a/tree.go
+++ b/tree.go
@@ -47,7 +47,7 @@ func (t *Tree) File(path string) (*File, error) {
return nil, ErrFileNotFound
}
- obj, err := t.r.s.ObjectStorage().Get(e.Hash)
+ obj, err := t.r.s.ObjectStorage().Get(e.Hash, core.BlobObject)
if err != nil {
if err == core.ErrObjectNotFound {
return nil, ErrFileNotFound // a git submodule
@@ -87,7 +87,7 @@ func (t *Tree) dir(baseName string) (*Tree, error) {
return nil, errDirNotFound
}
- obj, err := t.r.s.ObjectStorage().Get(entry.Hash)
+ obj, err := t.r.s.ObjectStorage().Get(entry.Hash, core.TreeObject)
if err != nil {
if err == core.ErrObjectNotFound { // git submodule
return nil, errDirNotFound