| 235 | } |
| 236 | |
| 237 | func (s *ObjectStorage) packfileFromCache(hash plumbing.Hash) *packfile.Packfile { |
| 238 | if s.packfiles == nil { |
| 239 | if s.options.KeepDescriptors { |
| 240 | s.packfiles = make(map[plumbing.Hash]*packfile.Packfile) |
| 241 | } else if s.options.MaxOpenDescriptors > 0 { |
| 242 | s.packList = make([]plumbing.Hash, s.options.MaxOpenDescriptors) |
| 243 | s.packfiles = make(map[plumbing.Hash]*packfile.Packfile, s.options.MaxOpenDescriptors) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | return s.packfiles[hash] |
| 248 | } |
| 249 | |
| 250 | func (s *ObjectStorage) storePackfileInCache(hash plumbing.Hash, p *packfile.Packfile) error { |
| 251 | if s.options.KeepDescriptors { |