Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit a47126b

Browse files
committed
pluming: object, adjust to new API names in format/commitgraph
Signed-off-by: Filip Navara <filip.navara@gmail.com>
1 parent 14c17dc commit a47126b

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

plumbing/object/commitnode_graph.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ type graphCommitNode struct {
2020
// Index of the node in the commit graph file
2121
index int
2222

23-
node *commitgraph.Node
24-
gci *graphCommitNodeIndex
23+
commitData *commitgraph.CommitData
24+
gci *graphCommitNodeIndex
2525
}
2626

2727
// graphCommitNodeIndex is an index that can load CommitNode objects from both the commit
@@ -43,16 +43,16 @@ func (gci *graphCommitNodeIndex) Get(hash plumbing.Hash) (CommitNode, error) {
4343
// Check the commit graph first
4444
parentIndex, err := gci.commitGraph.GetIndexByHash(hash)
4545
if err == nil {
46-
parent, err := gci.commitGraph.GetNodeByIndex(parentIndex)
46+
parent, err := gci.commitGraph.GetCommitDataByIndex(parentIndex)
4747
if err != nil {
4848
return nil, err
4949
}
5050

5151
return &graphCommitNode{
52-
hash: hash,
53-
index: parentIndex,
54-
node: parent,
55-
gci: gci,
52+
hash: hash,
53+
index: parentIndex,
54+
commitData: parent,
55+
gci: gci,
5656
}, nil
5757
}
5858

@@ -73,41 +73,41 @@ func (c *graphCommitNode) ID() plumbing.Hash {
7373
}
7474

7575
func (c *graphCommitNode) Tree() (*Tree, error) {
76-
return GetTree(c.gci.s, c.node.TreeHash)
76+
return GetTree(c.gci.s, c.commitData.TreeHash)
7777
}
7878

7979
func (c *graphCommitNode) CommitTime() time.Time {
80-
return c.node.When
80+
return c.commitData.When
8181
}
8282

8383
func (c *graphCommitNode) NumParents() int {
84-
return len(c.node.ParentIndexes)
84+
return len(c.commitData.ParentIndexes)
8585
}
8686

8787
func (c *graphCommitNode) ParentNodes() CommitNodeIter {
8888
return newParentgraphCommitNodeIter(c)
8989
}
9090

9191
func (c *graphCommitNode) ParentNode(i int) (CommitNode, error) {
92-
if i < 0 || i >= len(c.node.ParentIndexes) {
92+
if i < 0 || i >= len(c.commitData.ParentIndexes) {
9393
return nil, ErrParentNotFound
9494
}
9595

96-
parent, err := c.gci.commitGraph.GetNodeByIndex(c.node.ParentIndexes[i])
96+
parent, err := c.gci.commitGraph.GetCommitDataByIndex(c.commitData.ParentIndexes[i])
9797
if err != nil {
9898
return nil, err
9999
}
100100

101101
return &graphCommitNode{
102-
hash: c.node.ParentHashes[i],
103-
index: c.node.ParentIndexes[i],
104-
node: parent,
105-
gci: c.gci,
102+
hash: c.commitData.ParentHashes[i],
103+
index: c.commitData.ParentIndexes[i],
104+
commitData: parent,
105+
gci: c.gci,
106106
}, nil
107107
}
108108

109109
func (c *graphCommitNode) ParentHashes() []plumbing.Hash {
110-
return c.node.ParentHashes
110+
return c.commitData.ParentHashes
111111
}
112112

113113
func (c *graphCommitNode) Commit() (*Commit, error) {

plumbing/object/commitnode_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"path"
55

66
. "gopkg.in/check.v1"
7-
"gopkg.in/src-d/go-git-fixtures.v3"
7+
fixtures "gopkg.in/src-d/go-git-fixtures.v3"
88
"gopkg.in/src-d/go-git.v4/plumbing"
99
"gopkg.in/src-d/go-git.v4/plumbing/cache"
1010
"gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph"
@@ -131,7 +131,7 @@ func (s *CommitNodeSuite) TestMixedGraph(c *C) {
131131
memoryIndex := commitgraph.NewMemoryIndex()
132132
for i, hash := range fileIndex.Hashes() {
133133
if hash.String() != "b9d69064b190e7aedccf84731ca1d917871f8a1c" {
134-
node, err := fileIndex.GetNodeByIndex(i)
134+
node, err := fileIndex.GetCommitDataByIndex(i)
135135
c.Assert(err, IsNil)
136136
memoryIndex.Add(hash, node)
137137
}

0 commit comments

Comments
 (0)