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

Method ObjectStat

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

624
625// ObjectStat returns a os.FileInfo pointing the object file, if exists
626func (d *DotGit) ObjectStat(h plumbing.Hash) (os.FileInfo, error) {
627 err := d.hasObject(h)
628 if err != nil {
629 return nil, err
630 }
631
632 obj1, err1 := d.fs.Stat(d.objectPath(h))
633 if os.IsNotExist(err1) && d.hasIncomingObjects() {
634 obj2, err2 := d.fs.Stat(d.incomingObjectPath(h))
635 if err2 != nil {
636 return obj1, err1
637 }
638 return obj2, err2
639 }
640 return obj1, err1
641}
642
643// ObjectDelete removes the object file, if exists
644func (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.80

Tested by 1

TestObjectStatMethod · 0.64