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

Method ObjectStat

storage/filesystem/dotgit/dotgit.go:633–648  ·  view source on GitHub ↗

ObjectStat returns a os.FileInfo pointing the object file, if exists

(h plumbing.Hash)

Source from the content-addressed store, hash-verified

631
632// ObjectStat returns a os.FileInfo pointing the object file, if exists
633func (d *DotGit) ObjectStat(h plumbing.Hash) (os.FileInfo, error) {
634 err := d.hasObject(h)
635 if err != nil {
636 return nil, err
637 }
638
639 obj1, err1 := d.fs.Stat(d.objectPath(h))
640 if os.IsNotExist(err1) && d.hasIncomingObjects() {
641 obj2, err2 := d.fs.Stat(d.incomingObjectPath(h))
642 if err2 != nil {
643 return obj1, err1
644 }
645 return obj2, err2
646 }
647 return obj1, err1
648}
649
650// ObjectDelete removes the object file, if exists
651func (d *DotGit) ObjectDelete(h plumbing.Hash) error {

Callers 2

LooseObjectTimeMethod · 0.80
TestObjectStatMethod · 0.80

Calls 5

hasObjectMethod · 0.95
objectPathMethod · 0.95
hasIncomingObjectsMethod · 0.95
incomingObjectPathMethod · 0.95
StatMethod · 0.65

Tested by 1

TestObjectStatMethod · 0.64