MCPcopy Index your code
hub / github.com/celer-pkg/celer / GetCommitHash

Method GetCommitHash

configs/port_pkgcache.go:189–202  ·  view source on GitHub ↗

GetCommitHash try to get commit hash from `commitHashCache` first, if not exist then get it by calling `doGetCommitHash`.

(nameVersion string, native bool)

Source from the content-addressed store, hash-verified

187// GetCommitHash try to get commit hash from `commitHashCache` first,
188// if not exist then get it by calling `doGetCommitHash`.
189func (p Port) GetCommitHash(nameVersion string, native bool) (string, error) {
190 key := nameVersion
191 if v, ok := commitHashCache.Load(key); ok {
192 r := v.(metaResult)
193 return r.meta, r.err
194 }
195
196 // Don't cache ErrRepoNotExit — the repo may be cloned later in the same run.
197 result, err := p.doGetCommitHash(nameVersion, native)
198 if err == nil || !errors.Is(err, errors.ErrRepoNotExit) {
199 commitHashCache.Store(key, metaResult{meta: result, err: err})
200 }
201 return result, err
202}
203
204func (p Port) doGetCommitHash(nameVersion string, native bool) (string, error) {
205 var port = Port{DevDep: native}

Callers

nothing calls this directly

Calls 3

doGetCommitHashMethod · 0.95
IsFunction · 0.92
StoreMethod · 0.65

Tested by

no test coverage detected