diff options
Diffstat (limited to 'plumbing/object/file_test.go')
-rw-r--r-- | plumbing/object/file_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plumbing/object/file_test.go b/plumbing/object/file_test.go index 4c8bbb6..426fa8f 100644 --- a/plumbing/object/file_test.go +++ b/plumbing/object/file_test.go @@ -247,3 +247,29 @@ func (s *FileSuite) TestFileIter(c *C) { c.Assert(count, Equals, 1) } + +func (s *FileSuite) TestFileIterSubmodule(c *C) { + st, err := filesystem.NewStorage(fixtures.ByTag("submodule").One().DotGit()) + c.Assert(err, IsNil) + + hash := plumbing.NewHash("a692ec699bff9117c1ed91752afbb7d9d272ebef") + commit, err := GetCommit(st, hash) + c.Assert(err, IsNil) + + tree, err := commit.Tree() + c.Assert(err, IsNil) + + expected := []string{ + ".gitmodules", + } + + var count int + i := tree.Files() + i.ForEach(func(f *File) error { + c.Assert(f.Name, Equals, expected[count]) + count++ + return nil + }) + + c.Assert(count, Equals, 1) +} |