(hash plumbing.Hash)
| 41 | } |
| 42 | |
| 43 | func (gci *graphCommitNodeIndex) Get(hash plumbing.Hash) (CommitNode, error) { |
| 44 | if gci.commitGraph != nil { |
| 45 | // Check the commit graph first |
| 46 | parentIndex, err := gci.commitGraph.GetIndexByHash(hash) |
| 47 | if err == nil { |
| 48 | parent, err := gci.commitGraph.GetCommitDataByIndex(parentIndex) |
| 49 | if err != nil { |
| 50 | return nil, err |
| 51 | } |
| 52 | |
| 53 | return &graphCommitNode{ |
| 54 | hash: hash, |
| 55 | index: parentIndex, |
| 56 | commitData: parent, |
| 57 | gci: gci, |
| 58 | }, nil |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // Fallback to loading full commit object |
| 63 | commit, err := object.GetCommit(gci.s, hash) |
| 64 | if err != nil { |
| 65 | return nil, err |
| 66 | } |
| 67 | |
| 68 | return &objectCommitNode{ |
| 69 | nodeIndex: gci, |
| 70 | commit: commit, |
| 71 | }, nil |
| 72 | } |
| 73 | |
| 74 | func (c *graphCommitNode) ID() plumbing.Hash { |
| 75 | return c.hash |
nothing calls this directly
no test coverage detected