diff options
-rw-r--r-- | plumbing/revlist/revlist.go | 5 | ||||
-rw-r--r-- | plumbing/revlist/revlist_test.go | 20 |
2 files changed, 24 insertions, 1 deletions
diff --git a/plumbing/revlist/revlist.go b/plumbing/revlist/revlist.go index 3e02184..20bc99d 100644 --- a/plumbing/revlist/revlist.go +++ b/plumbing/revlist/revlist.go @@ -7,6 +7,7 @@ import ( "io" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/filemode" "gopkg.in/src-d/go-git.v4/plumbing/object" "gopkg.in/src-d/go-git.v4/plumbing/storer" ) @@ -121,6 +122,10 @@ func iterateCommitTrees( return err } + if e.Mode == filemode.Submodule { + continue + } + if seen[e.Hash] { continue } diff --git a/plumbing/revlist/revlist_test.go b/plumbing/revlist/revlist_test.go index 0baf27e..dd1e8c1 100644 --- a/plumbing/revlist/revlist_test.go +++ b/plumbing/revlist/revlist_test.go @@ -3,12 +3,12 @@ package revlist import ( "testing" - "github.com/src-d/go-git-fixtures" "gopkg.in/src-d/go-git.v4/plumbing" "gopkg.in/src-d/go-git.v4/plumbing/object" "gopkg.in/src-d/go-git.v4/plumbing/storer" "gopkg.in/src-d/go-git.v4/storage/filesystem" + "github.com/src-d/go-git-fixtures" . "gopkg.in/check.v1" ) @@ -62,6 +62,24 @@ func (s *RevListSuite) commit(c *C, h plumbing.Hash) *object.Commit { return commit } +func (s *RevListSuite) TestRevListObjects_Submodules(c *C) { + submodules := map[string]bool{ + "6ecf0ef2c2dffb796033e5a02219af86ec6584e5": true, + } + + sto, err := filesystem.NewStorage(fixtures.ByTag("submodule").One().DotGit()) + c.Assert(err, IsNil) + + ref, err := storer.ResolveReference(sto, plumbing.HEAD) + c.Assert(err, IsNil) + + revList, err := Objects(sto, []plumbing.Hash{ref.Hash()}, nil) + c.Assert(err, IsNil) + for _, h := range revList { + c.Assert(submodules[h.String()], Equals, false) + } +} + // --- // | |\ // | | * b8e471f Creating changelog |