MCPcopy Create free account
hub / github.com/go-git/go-git / hasIncomingObjects

Method hasIncomingObjects

storage/filesystem/dotgit/dotgit.go:588–605  ·  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

586// hasIncomingObjects searches for an incoming directory and keeps its name
587// so it doesn't have to be found each time an object is accessed.
588func (d *DotGit) hasIncomingObjects() bool {
589 if !d.incomingChecked {
590 directoryContents, err := d.fs.ReadDir(objectsPath)
591 if err == nil {
592 for _, file := range directoryContents {
593 if file.IsDir() && (strings.HasPrefix(file.Name(), "tmp_objdir-incoming-") ||
594 // Before Git 2.35 incoming commits directory had another prefix
595 strings.HasPrefix(file.Name(), "incoming-")) {
596 d.incomingDirName = file.Name()
597 }
598 }
599 }
600
601 d.incomingChecked = true
602 }
603
604 return d.incomingDirName != ""
605}
606
607// Object returns a fs.File pointing the object file, if exists
608func (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