diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-31 00:23:15 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-31 00:23:15 +0200 |
commit | 7aa8f0750c93b58876a06e79c50398901e5bdeb8 (patch) | |
tree | 3bfde1edae34f7774971d1f4f57547b741a04a00 /core | |
parent | d72a19796ef0f556db93b553547f2ac085b59a1a (diff) | |
download | go-git-7aa8f0750c93b58876a06e79c50398901e5bdeb8.tar.gz |
NewObjectLookupIter asking right type
Diffstat (limited to 'core')
-rw-r--r-- | core/object.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/object.go b/core/object.go index 6a22122..b439603 100644 --- a/core/object.go +++ b/core/object.go @@ -70,6 +70,8 @@ func (t ObjectType) String() string { return "ofs-delta" case REFDeltaObject: return "ref-delta" + case AnyObject: + return "any" default: return "unknown" } @@ -116,15 +118,17 @@ func ParseObjectType(value string) (typ ObjectType, err error) { type ObjectLookupIter struct { storage ObjectStorage series []Hash + t ObjectType pos int } // NewObjectLookupIter returns an object iterator given an object storage and // a slice of object hashes. -func NewObjectLookupIter(storage ObjectStorage, series []Hash) *ObjectLookupIter { +func NewObjectLookupIter(storage ObjectStorage, t ObjectType, series []Hash) *ObjectLookupIter { return &ObjectLookupIter{ storage: storage, series: series, + t: t, } } @@ -137,7 +141,7 @@ func (iter *ObjectLookupIter) Next() (Object, error) { return nil, io.EOF } hash := iter.series[iter.pos] - obj, err := iter.storage.Get(AnyObject, hash) + obj, err := iter.storage.Get(iter.t, hash) if err == nil { iter.pos++ } |