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

Method Object

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

606
607// Object returns a fs.File pointing the object file, if exists
608func (d *DotGit) Object(h plumbing.Hash) (billy.File, error) {
609 err := d.hasObject(h)
610 if err != nil {
611 return nil, err
612 }
613
614 obj1, err1 := d.fs.Open(d.objectPath(h))
615 if os.IsNotExist(err1) && d.hasIncomingObjects() {
616 obj2, err2 := d.fs.Open(d.incomingObjectPath(h))
617 if err2 != nil {
618 return obj1, err1
619 }
620 return obj2, err2
621 }
622 return obj1, err1
623}
624
625// ObjectStat returns a os.FileInfo pointing the object file, if exists
626func (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