MCPcopy
hub / github.com/go-git/go-git / hasIncomingObjects

Method hasIncomingObjects

storage/filesystem/dotgit/dotgit.go:595–612  ·  view source on GitHub ↗

hasIncomingObjects searches for an incoming directory and keeps its name so it doesn't have to be found each time an object is accessed.

()

Source from the content-addressed store, hash-verified

593// hasIncomingObjects searches for an incoming directory and keeps its name
594// so it doesn't have to be found each time an object is accessed.
595func (d *DotGit) hasIncomingObjects() bool {
596 if !d.incomingChecked {
597 directoryContents, err := d.fs.ReadDir(objectsPath)
598 if err == nil {
599 for _, file := range directoryContents {
600 if file.IsDir() && (strings.HasPrefix(file.Name(), "tmp_objdir-incoming-") ||
601 // Before Git 2.35 incoming commits directory had another prefix
602 strings.HasPrefix(file.Name(), "incoming-")) {
603 d.incomingDirName = file.Name()
604 }
605 }
606 }
607
608 d.incomingChecked = true
609 }
610
611 return d.incomingDirName != ""
612}
613
614// Object returns a fs.File pointing the object file, if exists
615func (d *DotGit) Object(h plumbing.Hash) (billy.File, error) {

Callers 3

ObjectMethod · 0.95
ObjectStatMethod · 0.95
ObjectDeleteMethod · 0.95

Calls 3

IsDirMethod · 0.65
NameMethod · 0.65
ReadDirMethod · 0.45

Tested by

no test coverage detected