IsAncestor determines if the first argument points to a commit that is an ancestor of the second.
(ancestor, descendant string)
| 299 | |
| 300 | // IsAncestor determines if the first argument points to a commit that is an ancestor of the second. |
| 301 | func (repo *GitRepo) IsAncestor(ancestor, descendant string) (bool, error) { |
| 302 | _, _, err := repo.runGitCommandRaw("merge-base", "--is-ancestor", ancestor, descendant) |
| 303 | if err == nil { |
| 304 | return true, nil |
| 305 | } |
| 306 | if _, ok := err.(*exec.ExitError); ok { |
| 307 | return false, nil |
| 308 | } |
| 309 | return false, fmt.Errorf("Error while trying to determine commit ancestry: %v", err) |
| 310 | } |
| 311 | |
| 312 | // Diff computes the diff between two given commits. |
| 313 | func (repo *GitRepo) Diff(left, right string, diffArgs ...string) (string, error) { |
no test coverage detected