ObjectStat returns a os.FileInfo pointing the object file, if exists
(h plumbing.Hash)
| 631 | |
| 632 | // ObjectStat returns a os.FileInfo pointing the object file, if exists |
| 633 | func (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 |
| 651 | func (d *DotGit) ObjectDelete(h plumbing.Hash) error { |