MCPcopy Index your code
hub / github.com/go-git/go-git / Object

Method Object

storage/filesystem/dotgit/dotgit.go:615–630  ·  view source on GitHub ↗

Object returns a fs.File pointing the object file, if exists

(h plumbing.Hash)

Source from the content-addressed store, hash-verified

613
614// Object returns a fs.File pointing the object file, if exists
615func (d *DotGit) Object(h plumbing.Hash) (billy.File, error) {
616 err := d.hasObject(h)
617 if err != nil {
618 return nil, err
619 }
620
621 obj1, err1 := d.fs.Open(d.objectPath(h))
622 if os.IsNotExist(err1) && d.hasIncomingObjects() {
623 obj2, err2 := d.fs.Open(d.incomingObjectPath(h))
624 if err2 != nil {
625 return obj1, err1
626 }
627 return obj2, err2
628 }
629 return obj1, err1
630}
631
632// ObjectStat returns a os.FileInfo pointing the object file, if exists
633func (d *DotGit) ObjectStat(h plumbing.Hash) (os.FileInfo, error) {

Callers 7

HasEncodedObjectMethod · 0.45
getFromUnpackedMethod · 0.45
ReaderMethod · 0.45
TestObjectMethod · 0.45
TestPreGit235ObjectMethod · 0.45
TestObjectNotFoundMethod · 0.45

Calls 5

hasObjectMethod · 0.95
objectPathMethod · 0.95
hasIncomingObjectsMethod · 0.95
incomingObjectPathMethod · 0.95
OpenMethod · 0.45

Tested by 3

TestObjectMethod · 0.36
TestPreGit235ObjectMethod · 0.36
TestObjectNotFoundMethod · 0.36