MCPcopy Index your code
hub / github.com/rilldata/rill / Hash

Function Hash

runtime/pkg/gitutil/gitcmdwrapper.go:202–211  ·  view source on GitHub ↗

Hash returns the commit hash for the given ref. Returns ErrRefNotFound if the ref does not resolve.

(ctx context.Context, path, ref string)

Source from the content-addressed store, hash-verified

200
201// Hash returns the commit hash for the given ref. Returns ErrRefNotFound if the ref does not resolve.
202func Hash(ctx context.Context, path, ref string) (string, error) {
203 out, err := Run(ctx, path, "rev-parse", "--verify", ref)
204 if err != nil {
205 if strings.Contains(err.Error(), "Needed a single revision") {
206 return "", ErrRefNotFound
207 }
208 return "", err
209 }
210 return out, nil
211}
212
213// Run executes a git command with the specified arguments in the given path and returns its output or an error.
214// If path is empty, the command runs without -C (use for commands like `clone` that take an explicit destination).

Callers 5

pullInnerMethod · 0.92
commitHashMethod · 0.92
TestFetchBranchesFunction · 0.85
TestHashFunction · 0.85
CommitAllFunction · 0.85

Calls 3

ContainsMethod · 0.80
RunFunction · 0.70
ErrorMethod · 0.45

Tested by 2

TestFetchBranchesFunction · 0.68
TestHashFunction · 0.68