aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/file.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2017-02-07 10:02:20 +0100
committerSantiago M. Mola <santi@mola.io>2017-02-07 10:02:20 +0100
commit1f39465975d56bbb02f5cdfb1e3e77f41c613f1d (patch)
treeac6b8caf7237a88092cbd20880d1beb118a668e3 /plumbing/object/file.go
parent2b1efd219e1f20d9a0bc380a26074c9d8de2ae1f (diff)
downloadgo-git-1f39465975d56bbb02f5cdfb1e3e77f41c613f1d.tar.gz
doc: improve object iterators godoc.
Diffstat (limited to 'plumbing/object/file.go')
-rw-r--r--plumbing/object/file.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/plumbing/object/file.go b/plumbing/object/file.go
index 618cea7..4caed6b 100644
--- a/plumbing/object/file.go
+++ b/plumbing/object/file.go
@@ -56,15 +56,20 @@ func (f *File) Lines() ([]string, error) {
return splits, nil
}
+// FileIter provides an iterator for the files in a tree.
type FileIter struct {
s storer.EncodedObjectStorer
w TreeWalker
}
+// NewFileIter takes a storer.EncodedObjectStorer and a Tree and returns a
+// *FileIter that iterates over all files contained in the tree, recursively.
func NewFileIter(s storer.EncodedObjectStorer, t *Tree) *FileIter {
return &FileIter{s: s, w: *NewTreeWalker(t, true)}
}
+// Next moves the iterator to the next file and returns a pointer to it. If
+// there are no more files, it returns io.EOF.
func (iter *FileIter) Next() (*File, error) {
for {
name, entry, err := iter.w.Next()