diff options
-rw-r--r-- | commit.go | 1 | ||||
-rw-r--r-- | core/object.go | 8 |
2 files changed, 7 insertions, 2 deletions
@@ -38,6 +38,7 @@ func (c *Commit) Tree() (*Tree, error) { func (c *Commit) Parents() *CommitIter { return NewCommitIter(c.r, core.NewObjectLookupIter( c.r.s.ObjectStorage(), + core.CommitObject, c.parents, )) } 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++ } |