aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Navara <filip.navara@gmail.com>2019-04-26 10:11:07 +0200
committerFilip Navara <filip.navara@gmail.com>2019-04-26 10:11:46 +0200
commita47126b1ae5020dbdd268b304fef45a59d63d99b (patch)
treec04ca9865ee3dea17adf0be50c739ec27a72940f
parent14c17dc6881fccf851c8bdffab15774faa3bce8b (diff)
downloadgo-git-a47126b1ae5020dbdd268b304fef45a59d63d99b.tar.gz
pluming: object, adjust to new API names in format/commitgraph
Signed-off-by: Filip Navara <filip.navara@gmail.com>
-rw-r--r--plumbing/object/commitnode_graph.go34
-rw-r--r--plumbing/object/commitnode_test.go4
2 files changed, 19 insertions, 19 deletions
diff --git a/plumbing/object/commitnode_graph.go b/plumbing/object/commitnode_graph.go
index 9fc28a2..b2a6f57 100644
--- a/plumbing/object/commitnode_graph.go
+++ b/plumbing/object/commitnode_graph.go
@@ -20,8 +20,8 @@ type graphCommitNode struct {
// Index of the node in the commit graph file
index int
- node *commitgraph.Node
- gci *graphCommitNodeIndex
+ commitData *commitgraph.CommitData
+ gci *graphCommitNodeIndex
}
// 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) {
// Check the commit graph first
parentIndex, err := gci.commitGraph.GetIndexByHash(hash)
if err == nil {
- parent, err := gci.commitGraph.GetNodeByIndex(parentIndex)
+ parent, err := gci.commitGraph.GetCommitDataByIndex(parentIndex)
if err != nil {
return nil, err
}
return &graphCommitNode{
- hash: hash,
- index: parentIndex,
- node: parent,
- gci: gci,
+ hash: hash,
+ index: parentIndex,
+ commitData: parent,
+ gci: gci,
}, nil
}
@@ -73,15 +73,15 @@ func (c *graphCommitNode) ID() plumbing.Hash {
}
func (c *graphCommitNode) Tree() (*Tree, error) {
- return GetTree(c.gci.s, c.node.TreeHash)
+ return GetTree(c.gci.s, c.commitData.TreeHash)
}
func (c *graphCommitNode) CommitTime() time.Time {
- return c.node.When
+ return c.commitData.When
}
func (c *graphCommitNode) NumParents() int {
- return len(c.node.ParentIndexes)
+ return len(c.commitData.ParentIndexes)
}
func (c *graphCommitNode) ParentNodes() CommitNodeIter {
@@ -89,25 +89,25 @@ func (c *graphCommitNode) ParentNodes() CommitNodeIter {
}
func (c *graphCommitNode) ParentNode(i int) (CommitNode, error) {
- if i < 0 || i >= len(c.node.ParentIndexes) {
+ if i < 0 || i >= len(c.commitData.ParentIndexes) {
return nil, ErrParentNotFound
}
- parent, err := c.gci.commitGraph.GetNodeByIndex(c.node.ParentIndexes[i])
+ parent, err := c.gci.commitGraph.GetCommitDataByIndex(c.commitData.ParentIndexes[i])
if err != nil {
return nil, err
}
return &graphCommitNode{
- hash: c.node.ParentHashes[i],
- index: c.node.ParentIndexes[i],
- node: parent,
- gci: c.gci,
+ hash: c.commitData.ParentHashes[i],
+ index: c.commitData.ParentIndexes[i],
+ commitData: parent,
+ gci: c.gci,
}, nil
}
func (c *graphCommitNode) ParentHashes() []plumbing.Hash {
- return c.node.ParentHashes
+ return c.commitData.ParentHashes
}
func (c *graphCommitNode) Commit() (*Commit, error) {
diff --git a/plumbing/object/commitnode_test.go b/plumbing/object/commitnode_test.go
index 3a70db3..a295b8b 100644
--- a/plumbing/object/commitnode_test.go
+++ b/plumbing/object/commitnode_test.go
@@ -4,7 +4,7 @@ import (
"path"
. "gopkg.in/check.v1"
- "gopkg.in/src-d/go-git-fixtures.v3"
+ fixtures "gopkg.in/src-d/go-git-fixtures.v3"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/cache"
"gopkg.in/src-d/go-git.v4/plumbing/format/commitgraph"
@@ -131,7 +131,7 @@ func (s *CommitNodeSuite) TestMixedGraph(c *C) {
memoryIndex := commitgraph.NewMemoryIndex()
for i, hash := range fileIndex.Hashes() {
if hash.String() != "b9d69064b190e7aedccf84731ca1d917871f8a1c" {
- node, err := fileIndex.GetNodeByIndex(i)
+ node, err := fileIndex.GetCommitDataByIndex(i)
c.Assert(err, IsNil)
memoryIndex.Add(hash, node)
}