Parent returns the ith parent of a commit.
(i int)
| 197 | |
| 198 | // Parent returns the ith parent of a commit. |
| 199 | func (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 |