MCPcopy Index your code
hub / github.com/go-git/go-git / ParentNode

Method ParentNode

plumbing/object/commitgraph/commitnode_graph.go:94–110  ·  view source on GitHub ↗
(i int)

Source from the content-addressed store, hash-verified

92}
93
94func (c *graphCommitNode) ParentNode(i int) (CommitNode, error) {
95 if i < 0 || i >= len(c.commitData.ParentIndexes) {
96 return nil, object.ErrParentNotFound
97 }
98
99 parent, err := c.gci.commitGraph.GetCommitDataByIndex(c.commitData.ParentIndexes[i])
100 if err != nil {
101 return nil, err
102 }
103
104 return &graphCommitNode{
105 hash: c.commitData.ParentHashes[i],
106 index: c.commitData.ParentIndexes[i],
107 commitData: parent,
108 gci: c.gci,
109 }, nil
110}
111
112func (c *graphCommitNode) ParentHashes() []plumbing.Hash {
113 return c.commitData.ParentHashes

Callers

nothing calls this directly

Calls 1

GetCommitDataByIndexMethod · 0.65

Tested by

no test coverage detected