Object returns a fs.File pointing the object file, if exists
(h plumbing.Hash)
| 613 | |
| 614 | // Object returns a fs.File pointing the object file, if exists |
| 615 | func (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 |
| 633 | func (d *DotGit) ObjectStat(h plumbing.Hash) (os.FileInfo, error) { |