Parent returns the ith parent of a commit.
(i int)
| 138 | |
| 139 | // Parent returns the ith parent of a commit. |
| 140 | func (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 |