code: func (p *Packfile) GetByType(typ plumbing.ObjectType) (storer.EncodedObjectIter, error) {
  	switch typ {
  	case plumbing.AnyObject,
  		plumbing.BlobObject,
  		plumbing.TreeObject,
  		plumbing.CommitObject,
  		plumbing.TagObject:
  		entries, err := p.EntriesByOffset()
  		if err != nil {
  			return nil, err
  		}
  
  		return &objectIter{
  			// Easiest way to provide an object decoder is just to pass a Packfile
  			// instance. To not mess with the seeks, it's a new instance with a
  			// different scanner but the same cache and offset to hash map for
  			// reusing as much cache as possible.
  			p:    p,
  			iter: entries,
  			typ:  typ,
  		}, nil
  	default:
  		return nil, plumbing.ErrInvalidType
  	}
  }
docs: // GetByType returns all the objects of the given type.