aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2016-08-29 23:06:10 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-29 23:06:10 +0200
commitb73657f1aa7016bdd4c2cbd50bee4c20d5ab69ef (patch)
tree7f93f11b91b84e605a26f573d40791a4f6cb49d0 /storage/filesystem
parente4246138cb9ffb819c052ba17a9fbdf915427291 (diff)
downloadgo-git-b73657f1aa7016bdd4c2cbd50bee4c20d5ab69ef.tar.gz
core: Storage.Get, switch order of args
Diffstat (limited to 'storage/filesystem')
-rw-r--r--storage/filesystem/object.go4
-rw-r--r--storage/filesystem/object_test.go4
2 files changed, 4 insertions, 4 deletions
diff --git a/storage/filesystem/object.go b/storage/filesystem/object.go
index 6024ae0..1b1ce9d 100644
--- a/storage/filesystem/object.go
+++ b/storage/filesystem/object.go
@@ -38,7 +38,7 @@ func (s *ObjectStorage) Set(core.Object) (core.Hash, error) {
// Get returns the object with the given hash, by searching for it in
// the packfile.
-func (s *ObjectStorage) Get(h core.Hash, t core.ObjectType) (core.Object, error) {
+func (s *ObjectStorage) Get(t core.ObjectType, h core.Hash) (core.Object, error) {
offset, err := s.index.Get(h)
if err != nil {
return nil, err
@@ -87,7 +87,7 @@ func (s *ObjectStorage) Iter(t core.ObjectType) (core.ObjectIter, error) {
var objects []core.Object
for hash := range s.index {
- object, err := s.Get(hash, core.AnyObject)
+ object, err := s.Get(core.AnyObject, hash)
if err != nil {
return nil, err
}
diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go
index 956fdeb..361ae32 100644
--- a/storage/filesystem/object_test.go
+++ b/storage/filesystem/object_test.go
@@ -66,7 +66,7 @@ func (s *FsSuite) TestHashNotFound(c *C) {
sto := s.newObjectStorage(c, "binary-relations")
types := []core.ObjectType{core.AnyObject, core.TagObject, core.CommitObject, core.BlobObject, core.TreeObject}
for t := range types {
- _, err := sto.Get(core.ZeroHash, core.ObjectType(t))
+ _, err := sto.Get(core.ObjectType(t), core.ZeroHash)
c.Assert(err, Equals, core.ErrObjectNotFound)
}
}
@@ -158,7 +158,7 @@ func equalsStorages(a, b core.ObjectStorage) (bool, string, error) {
break
}
- bo, err := b.Get(ao.Hash(), core.AnyObject)
+ bo, err := b.Get(core.AnyObject, ao.Hash())
if err != nil {
return false, "", fmt.Errorf("getting object with hash %s: %s",
ao.Hash(), err)