aboutsummaryrefslogtreecommitdiffstats
path: root/tree.go
diff options
context:
space:
mode:
authorJoshua Sjoding <joshs@scjalliance.com>2016-01-23 00:50:29 -0800
committerJoshua Sjoding <joshs@scjalliance.com>2016-01-23 00:50:29 -0800
commit7ba1014b73e4d466320a29f7e3f47fcefe58695d (patch)
treebe9ff334eaae5547651d2084021fcfd4b70a9db9 /tree.go
parent050fb78d77b30014acd0b6eefc88ec8a49c20371 (diff)
downloadgo-git-7ba1014b73e4d466320a29f7e3f47fcefe58695d.tar.gz
Repository now works against the generic ObjectStore interface
Diffstat (limited to 'tree.go')
-rw-r--r--tree.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/tree.go b/tree.go
index e88b1e6..8398725 100644
--- a/tree.go
+++ b/tree.go
@@ -187,19 +187,20 @@ func (t *Tree) Decode(o core.Object) error {
}
type TreeIter struct {
- iter
+ core.ObjectIter
+ r *Repository
}
-func NewTreeIter(r *Repository) *TreeIter {
- return &TreeIter{newIter(r)}
+func NewTreeIter(r *Repository, iter core.ObjectIter) *TreeIter {
+ return &TreeIter{iter, r}
}
-func (i *TreeIter) Next() (*Tree, error) {
- obj := <-i.ch
- if obj == nil {
- return nil, io.EOF
+func (iter *TreeIter) Next() (*Tree, error) {
+ obj, err := iter.ObjectIter.Next()
+ if err != nil {
+ return nil, err
}
- tree := &Tree{r: i.r}
+ tree := &Tree{r: iter.r}
return tree, tree.Decode(obj)
}