aboutsummaryrefslogtreecommitdiffstats
path: root/commit_test.go
diff options
context:
space:
mode:
authorJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-16 12:29:06 -0800
committerJoshua Sjoding <joshua.sjoding@scjalliance.com>2016-02-17 04:46:57 -0800
commit9df17e545a445f58c5c43a1ece49bf1ff09e3b02 (patch)
treef1e50178d47e6c4bd68df613a338036280c30c9b /commit_test.go
parent6b0a5984ac0c69742e60a39ad9437fd981dbe31b (diff)
downloadgo-git-9df17e545a445f58c5c43a1ece49bf1ff09e3b02.tar.gz
New iteration behavior via FileIter and TreeWalker
Instead of returning a channel of files, Tree.Files() now returns a FileIter with these qualities: * It returns files in the original order of the repository (relying on a * new Tree.OrderedNames property) * It can return errors encountered when retrieving files and trees from * underlying storage * It can be Closed without having to drain the entire channel * It defers the heavy lifting to a new TreeWalker type * Its behavior is a little more consistent with other Iter types * It's a little less prone to memory leaks This update includes a new TreeWalker type that will iterate through all of the entries of a tree and its descendant subtrees. It does the dirty work that Tree.walkEntries() used to do, but with a public API. A new TreeIter type is also included that just walks through subtrees. This could be useful for performing a directory search while ignoring files/blobs altogether.
Diffstat (limited to 'commit_test.go')
-rw-r--r--commit_test.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/commit_test.go b/commit_test.go
index fbaccd6..62af890 100644
--- a/commit_test.go
+++ b/commit_test.go
@@ -41,7 +41,7 @@ func (s *SuiteCommit) SetUpSuite(c *C) {
}
}
-var iterTests = []struct {
+var commitIterTests = []struct {
repo string // the repo name in the test suite's map of fixtures
commits []string // the commit hashes to iterate over in the test
}{
@@ -59,7 +59,7 @@ var iterTests = []struct {
}
func (s *SuiteCommit) TestIterSlice(c *C) {
- for i, t := range iterTests {
+ for i, t := range commitIterTests {
r := s.repos[t.repo]
iter := NewCommitIter(r, core.NewObjectSliceIter(makeObjectSlice(t.commits, r.Storage)))
s.checkIter(c, r, i, iter, t.commits)
@@ -67,7 +67,7 @@ func (s *SuiteCommit) TestIterSlice(c *C) {
}
func (s *SuiteCommit) TestIterLookup(c *C) {
- for i, t := range iterTests {
+ for i, t := range commitIterTests {
r := s.repos[t.repo]
iter := NewCommitIter(r, core.NewObjectLookupIter(r.Storage, makeHashSlice(t.commits)))
s.checkIter(c, r, i, iter, t.commits)
@@ -85,7 +85,7 @@ func (s *SuiteCommit) checkIter(c *C, r *Repository, subtest int, iter *CommitIt
}
func (s *SuiteCommit) TestIterSliceClose(c *C) {
- for i, t := range iterTests {
+ for i, t := range commitIterTests {
r := s.repos[t.repo]
iter := NewCommitIter(r, core.NewObjectSliceIter(makeObjectSlice(t.commits, r.Storage)))
s.checkIterClose(c, i, iter)
@@ -93,7 +93,7 @@ func (s *SuiteCommit) TestIterSliceClose(c *C) {
}
func (s *SuiteCommit) TestIterLookupClose(c *C) {
- for i, t := range iterTests {
+ for i, t := range commitIterTests {
r := s.repos[t.repo]
iter := NewCommitIter(r, core.NewObjectLookupIter(r.Storage, makeHashSlice(t.commits)))
s.checkIterClose(c, i, iter)