@@ -53,7 +53,29 @@ func testWalker(c *C, nodeIndex CommitNodeIndex) {
5353 }
5454}
5555
56- func (s * CommitNodeSuite ) TestWalkObject (c * C ) {
56+ func testParents (c * C , nodeIndex CommitNodeIndex ) {
57+ merge3 , err := nodeIndex .Get (plumbing .NewHash ("6f6c5d2be7852c782be1dd13e36496dd7ad39560" ))
58+ c .Assert (err , IsNil )
59+
60+ var parents []CommitNode
61+ merge3 .ParentNodes ().ForEach (func (c CommitNode ) error {
62+ parents = append (parents , c )
63+ return nil
64+ })
65+
66+ c .Assert (parents , HasLen , 3 )
67+
68+ expected := []string {
69+ "ce275064ad67d51e99f026084e20827901a8361c" ,
70+ "bb13916df33ed23004c3ce9ed3b8487528e655c1" ,
71+ "a45273fe2d63300e1962a9e26a6b15c276cd7082" ,
72+ }
73+ for i , parent := range parents {
74+ c .Assert (parent .ID ().String (), Equals , expected [i ])
75+ }
76+ }
77+
78+ func (s * CommitNodeSuite ) TestObjectGraph (c * C ) {
5779 f := fixtures .ByTag ("commit-graph" ).One ()
5880 storer := filesystem .NewStorage (f .DotGit (), cache .NewObjectLRUDefault ())
5981 p := f .Packfile ()
@@ -63,9 +85,10 @@ func (s *CommitNodeSuite) TestWalkObject(c *C) {
6385
6486 nodeIndex := NewObjectCommitNodeIndex (storer )
6587 testWalker (c , nodeIndex )
88+ testParents (c , nodeIndex )
6689}
6790
68- func (s * CommitNodeSuite ) TestWalkCommitGraph (c * C ) {
91+ func (s * CommitNodeSuite ) TestCommitGraph (c * C ) {
6992 f := fixtures .ByTag ("commit-graph" ).One ()
7093 dotgit := f .DotGit ()
7194 storer := filesystem .NewStorage (dotgit , cache .NewObjectLRUDefault ())
@@ -77,4 +100,5 @@ func (s *CommitNodeSuite) TestWalkCommitGraph(c *C) {
77100
78101 nodeIndex := NewGraphCommitNodeIndex (index , storer )
79102 testWalker (c , nodeIndex )
103+ testParents (c , nodeIndex )
80104}
0 commit comments