MCPcopy Create free account
hub / github.com/go-git/go-git / Parent

Method Parent

plumbing/object/commit.go:140–146  ·  view source on GitHub ↗

Parent returns the ith parent of a commit.

(i int)

Source from the content-addressed store, hash-verified

138
139// Parent returns the ith parent of a commit.
140func (c *Commit) Parent(i int) (*Commit, error) {
141 if len(c.ParentHashes) == 0 || i > len(c.ParentHashes)-1 {
142 return nil, ErrParentNotFound
143 }
144
145 return GetCommit(c.s, c.ParentHashes[i])
146}
147
148// File returns the file with the specified "path" in the commit and a
149// nil error if the file exists. If the file does not exist, it returns

Callers 3

TestParentMethod · 0.80
TestParentNotFoundMethod · 0.80
TestTreeDiffMethod · 0.80

Calls 1

GetCommitFunction · 0.85

Tested by 3

TestParentMethod · 0.64
TestParentNotFoundMethod · 0.64
TestTreeDiffMethod · 0.64