resolveCommit returns the immutable commit SHA a ref points at, or "" when the ref does not resolve to a commit (e.g. an unborn HEAD, or a bad ref). The ^{commit} peel collapses a tag or tree ref to its commit; --verify --quiet makes an unresolvable ref exit non-zero silently rather than printing an
(ctx context.Context, ref string)
| 525 | // ^{commit} peel collapses a tag or tree ref to its commit; --verify --quiet |
| 526 | // makes an unresolvable ref exit non-zero silently rather than printing an error. |
| 527 | func (p *Provider) resolveCommit(ctx context.Context, ref string) string { |
| 528 | out, err := p.runGit(ctx, "rev-parse", "--verify", "--quiet", "--end-of-options", ref+"^{commit}") |
| 529 | if err != nil { |
| 530 | return "" |
| 531 | } |
| 532 | return firstLine(out) |
| 533 | } |
| 534 | |
| 535 | // commitParents returns the parent commit SHAs of ref: zero for a root commit, |
| 536 | // one for an ordinary commit, and 2+ for a merge. It uses `rev-list --parents -n |
no test coverage detected