(h plumbing.Hash)
| 76 | } |
| 77 | |
| 78 | func (s *ObjectStorage) loadIdxFile(h plumbing.Hash) (err error) { |
| 79 | f, err := s.dir.ObjectPackIdx(h) |
| 80 | if err != nil { |
| 81 | return err |
| 82 | } |
| 83 | |
| 84 | defer ioutil.CheckClose(f, &err) |
| 85 | |
| 86 | idxf := idxfile.NewMemoryIndex() |
| 87 | d := idxfile.NewDecoder(f) |
| 88 | if err = d.Decode(idxf); err != nil { |
| 89 | return err |
| 90 | } |
| 91 | |
| 92 | if !bytes.Equal(idxf.PackfileChecksum[:], h[:]) { |
| 93 | return fmt.Errorf("%w: packfile mismatch: target is %q not %q", |
| 94 | idxfile.ErrMalformedIdxFile, hex.EncodeToString(idxf.PackfileChecksum[:]), h.String()) |
| 95 | } |
| 96 | |
| 97 | s.index[h] = idxf |
| 98 | return err |
| 99 | } |
| 100 | |
| 101 | func (s *ObjectStorage) NewEncodedObject() plumbing.EncodedObject { |
| 102 | return &plumbing.MemoryObject{} |
no test coverage detected