MCPcopy Create free account
hub / github.com/celer-pkg/celer / revParse

Function revParse

pkgs/git/local.go:403–410  ·  view source on GitHub ↗

revParse returns the full commit hash for the given repo ref from local repo. The ref can be any valid git revision (branch, tag, HEAD, commit hash, etc.).

(repoDir, repoRef string)

Source from the content-addressed store, hash-verified

401// revParse returns the full commit hash for the given repo ref from local repo.
402// The ref can be any valid git revision (branch, tag, HEAD, commit hash, etc.).
403func revParse(repoDir, repoRef string) (string, error) {
404 cmd := exec.Command("git", "-C", repoDir, "rev-parse", repoRef)
405 output, err := cmd.CombinedOutput()
406 if err != nil {
407 return "", fmt.Errorf("failed to git rev-parse %q -> %s", repoRef, output)
408 }
409 return strings.TrimSpace(string(output)), nil
410}
411
412// fetchRemoteRef fetch a specific remote ref (branch, tag, or commit).
413func fetchRemoteRef(nameVersion, repoDir, remoteName, refName string) error {

Callers 1

revParseCommitFunction · 0.85

Calls 1

CommandMethod · 0.65

Tested by

no test coverage detected