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

Method Parent

plumbing/object/commit.go:199–205  ·  view source on GitHub ↗

Parent returns the ith parent of a commit.

(i int)

Source from the content-addressed store, hash-verified

197
198// Parent returns the ith parent of a commit.
199func (c *Commit) Parent(i int) (*Commit, error) {
200 if len(c.ParentHashes) == 0 || i > len(c.ParentHashes)-1 {
201 return nil, ErrParentNotFound
202 }
203
204 return GetCommit(c.s, c.ParentHashes[i])
205}
206
207// File returns the file with the specified "path" in the commit and a
208// 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