MCPcopy Index your code
hub / github.com/git-bug/git-bug / Remove

Method Remove

cache/subcache.go:471–502  ·  view source on GitHub ↗
(prefix string)

Source from the content-addressed store, hash-verified

469}
470
471func (sc *SubCache[EntityT, ExcerptT, CacheT]) Remove(prefix string) error {
472 e, err := sc.ResolvePrefix(prefix)
473 if err != nil {
474 return err
475 }
476
477 sc.mu.Lock()
478
479 err = sc.actions.Remove(sc.repo, e.Id())
480 if err != nil {
481 sc.mu.Unlock()
482 return err
483 }
484
485 delete(sc.cached, e.Id())
486 delete(sc.excerpts, e.Id())
487 sc.lru.Remove(e.Id())
488
489 index, err := sc.repo.GetIndex(sc.namespace)
490 if err != nil {
491 sc.mu.Unlock()
492 return err
493 }
494
495 err = index.Remove(e.Id().String())
496 sc.mu.Unlock()
497 if err != nil {
498 return err
499 }
500
501 return sc.write()
502}
503
504func (sc *SubCache[EntityT, ExcerptT, CacheT]) RemoveAll() error {
505 sc.mu.Lock()

Callers

nothing calls this directly

Calls 7

ResolvePrefixMethod · 0.95
writeMethod · 0.95
LockMethod · 0.65
RemoveMethod · 0.65
IdMethod · 0.65
GetIndexMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected