MCPcopy Index your code
hub / github.com/google/git-appraise / IsAncestor

Method IsAncestor

repository/git.go:301–310  ·  view source on GitHub ↗

IsAncestor determines if the first argument points to a commit that is an ancestor of the second.

(ancestor, descendant string)

Source from the content-addressed store, hash-verified

299
300// IsAncestor determines if the first argument points to a commit that is an ancestor of the second.
301func (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.
313func (repo *GitRepo) Diff(left, right string, diffArgs ...string) (string, error) {

Callers 2

mergeArchivesMethod · 0.95
ArchiveRefMethod · 0.95

Calls 1

runGitCommandRawMethod · 0.95

Tested by

no test coverage detected