diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-13 00:15:19 +0100 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2017-02-13 00:15:19 +0100 |
commit | b18d6490aefe8509791843136530e3426d0c8200 (patch) | |
tree | 64cbc583f64483f667234833a8bf4abc7f5c0084 /plumbing/object/file_test.go | |
parent | b3b6e51565dcdbf81546f1d8f0121874a4e4fce9 (diff) | |
download | go-git-b18d6490aefe8509791843136530e3426d0c8200.tar.gz |
plumbing/object: allow TreeIter return SubModule entries
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) +} |